using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.Model;
|
using CY.Infrastructure.Query;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
using CY.Model.Inquiry;
|
using CY.SQLDAL;
|
using System.Data.SqlClient;
|
using CY.Infrastructure.Logging;
|
|
namespace CY.WebForm.Pages.business
|
{
|
public partial class CorporateClientsVisit : BasePage
|
{
|
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;//字典业务逻辑操作类对象
|
SysInquiry_PrintingTypeBLL bll_SysInquiry_PrintingTypeBLL = null;//印刷业务类型业务逻辑操作类对象
|
/// <summary>
|
/// 是否需要节假日维护
|
/// </summary>
|
public bool IsNeedJiejiaRi { get; set; }
|
/// <summary>
|
/// 是否需要维护
|
/// </summary>
|
public bool NeedWeihu { get; set; }
|
|
/// <summary>
|
/// 合作客户例子
|
/// </summary>
|
public OA_CorporateClients client { get; set; }
|
//初始化
|
public CorporateClientsVisit()
|
{
|
bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
|
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
bll_SysInquiry_PrintingTypeBLL = new SysInquiry_PrintingTypeBLL();
|
}
|
/// <summary>
|
/// 是否时维护提醒传过来的
|
/// </summary>
|
public bool IsWeihuTixingUrl { get; set; } = false;
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
|
if (Request["Keyid"] != null || Request["MemberId"] != null)
|
{
|
OA_CorporateClients m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModelDetail(Request["Keyid"].ToGuid2());
|
this.spanCompanyName.InnerText = m_OA_CorporateClients.CompanyName;
|
this.spanBusinessManagerId.InnerText = m_OA_CorporateClients.BusinessmanagerName;
|
this.spanprintdate.InnerText = DateTime.Now.ToString("yyyy-MM-dd");
|
client = bll_OA_CorporateClientsBLL.GetModel(Request["Keyid"].ToGuid2());
|
IsNeedJiejiaRi = client.JieJiaRiWiHu==true;
|
NeedWeihu = client.NeedWiHu == true;
|
this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Request["Keyid"].ToGuid2());
|
|
this.RepClientList.DataBind();
|
if (IsNeedJiejiaRi)
|
this.btn_Submit.Enabled = true;
|
else
|
this.btn_Submit.Enabled = false;
|
|
|
//判决是否是节假日维护弹窗 这个弹窗添加维护记录后会关闭窗口
|
var x = Request["JIeriCount"];
|
if (x != "undefined"&&x!=null)
|
{
|
this.Button1.Enabled = false;
|
this.txtvisitRemark.Value = x;
|
}
|
|
this.txtVisitTime.Value = DateTime.Now.ToString("yyyy-MM-dd");
|
//判决是否是提醒弹窗 这个弹窗添加维护记录后会关闭窗口
|
var y = Request["tixingweihu"];
|
if ( y != null&& y=="1")
|
{
|
IsWeihuTixingUrl = true;
|
}
|
|
|
}
|
|
|
}
|
//完结事件
|
protected void btn_Submit_Visit(object sender, EventArgs e)
|
{
|
OA_CorporateClientsVisit m_OA_CorporateClientsVisit = new OA_CorporateClientsVisit();
|
|
|
try
|
{
|
Guid Keyid = Request["Keyid"].ToGuid2();
|
|
|
|
|
if (Request["Keyid"] != null)
|
{
|
|
|
}
|
else
|
{
|
JavaScript.MessageBox("请先保存客户", this);
|
}
|
|
if (this.txtVisitTime.Value == "")
|
{
|
JavaScript.MessageBox("请选择日期", this);
|
|
}
|
if (this.txtVisitTime.Value == "")
|
{
|
JavaScript.MessageBox("请填写维护记录", this);
|
|
}
|
|
m_OA_CorporateClientsVisit.Keyid = Guid.NewGuid();
|
|
|
m_OA_CorporateClientsVisit.CorporateClientsid = Keyid;
|
|
m_OA_CorporateClientsVisit.VisitTime = this.txtVisitTime.Value.ToDateTime2();
|
|
m_OA_CorporateClientsVisit.Remark = this.txtvisitRemark.Value.ToString2();
|
m_OA_CorporateClientsVisit.Creater = CurrentUser.TrueMemberId;
|
m_OA_CorporateClientsVisit.CreateTime = DateTime.Now;
|
m_OA_CorporateClientsVisit.Updater = CurrentUser.TrueMemberId;
|
m_OA_CorporateClientsVisit.LastUpdateTime = DateTime.Now;
|
|
|
#region 添加或编辑
|
|
|
bool result = bll_OA_CorporateClientsBLL.InsertModelVisit(m_OA_CorporateClientsVisit);//更新信息
|
|
if (result)
|
{
|
//this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Keyid);
|
//this.RepClientList.DataBind();
|
this.txtVisitTime.Value = "";
|
this.txtvisitRemark.Value = "";
|
JavaScript.MessageBox("维护保存成功", this, false, false);
|
if (NeedWeihu)
|
{
|
|
Database DC = new Database();
|
string sqlStr = string.Format("USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [NeedWiHu] = 'false' where Keyid='{0}'", Request["Keyid"]);
|
|
try
|
{
|
SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection);
|
//SqlDataAdapter myDa = new SqlDataAdapter(myCmd);
|
int a = myCmd.ExecuteNonQuery();
|
//myDa.Dispose();
|
|
|
}
|
catch (Exception ee)
|
{
|
new Log4NetAdapter().Log("中秋节提醒错误 错误:" + ee.Message);
|
this.txtVisitTime.Value = "";
|
this.txtvisitRemark.Value = "";
|
JavaScript.MessageBox("清除维护标志失败", this, false, false);
|
|
}
|
finally
|
{
|
if (DC.Connection.State != System.Data.ConnectionState.Closed)
|
DC.Connection.Close();
|
}
|
|
|
|
}
|
|
|
|
}
|
|
else
|
JavaScript.MessageBox("维护保存失败", this);
|
this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Request["Keyid"].ToGuid2());
|
this.RepClientList.DataBind();
|
//Province = CurrentUser.Province;
|
//City = CurrentUser.City;
|
//County = CurrentUser.County;
|
//BindData();
|
if (IsWeihuTixingUrl)
|
JavaScript.RefreshDIVOpener(this);
|
#endregion
|
|
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
if (IsWeihuTixingUrl)
|
JavaScript.RefreshDIVOpener(this);
|
}
|
}
|
|
protected void btn_Submit_Visit_jiari(object sender, EventArgs e)
|
{
|
|
|
OA_CorporateClientsVisit m_OA_CorporateClientsVisit = new OA_CorporateClientsVisit();
|
|
|
try
|
{
|
Guid Keyid = Request["Keyid"].ToGuid2();
|
|
|
|
|
if (Request["Keyid"] != null)
|
{
|
|
|
}
|
else
|
{
|
JavaScript.MessageBox("请先保存客户", this);
|
}
|
|
if (this.txtVisitTime.Value == "")
|
{
|
JavaScript.MessageBox("请选择日期", this);
|
|
}
|
if (this.txtVisitTime.Value == "")
|
{
|
JavaScript.MessageBox("请填写维护记录", this);
|
|
}
|
|
m_OA_CorporateClientsVisit.Keyid = Guid.NewGuid();
|
|
|
m_OA_CorporateClientsVisit.CorporateClientsid = Keyid;
|
|
m_OA_CorporateClientsVisit.VisitTime = this.txtVisitTime.Value.ToDateTime2();
|
|
m_OA_CorporateClientsVisit.Remark = this.txtvisitRemark.Value.ToString2();
|
m_OA_CorporateClientsVisit.Creater = CurrentUser.TrueMemberId;
|
m_OA_CorporateClientsVisit.CreateTime = DateTime.Now;
|
m_OA_CorporateClientsVisit.Updater = CurrentUser.TrueMemberId;
|
m_OA_CorporateClientsVisit.LastUpdateTime = DateTime.Now;
|
|
|
#region 添加或编辑
|
|
|
bool result = bll_OA_CorporateClientsBLL.InsertModelVisit(m_OA_CorporateClientsVisit);//更新信息
|
|
if (result)
|
{
|
//this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Keyid);
|
//this.RepClientList.DataBind();
|
this.txtVisitTime.Value = "";
|
this.txtvisitRemark.Value = "";
|
JavaScript.MessageBox("维护保存成功", this, false, false);
|
if (IsNeedJiejiaRi)
|
{
|
|
Database DC = new Database();
|
|
string sqlStr = string.Format("USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'false' where Keyid='{0}'", Request["Keyid"]);
|
|
try
|
{
|
SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection);
|
//SqlDataAdapter myDa = new SqlDataAdapter(myCmd);
|
int a = myCmd.ExecuteNonQuery();
|
//myDa.Dispose();
|
|
|
}
|
catch (Exception ee)
|
{
|
new Log4NetAdapter().Log("节假日清除标志 错误:" + ee.Message);
|
this.txtVisitTime.Value = "";
|
this.txtvisitRemark.Value = "";
|
JavaScript.MessageBox("清除维护标志失败", this, false, false);
|
|
}
|
finally
|
{
|
if (DC.Connection.State != System.Data.ConnectionState.Closed)
|
DC.Connection.Close();
|
}
|
|
|
|
}
|
|
|
|
}
|
|
else
|
JavaScript.MessageBox("维护保存失败", this);
|
this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Request["Keyid"].ToGuid2());
|
this.RepClientList.DataBind();
|
JavaScript.MessageBox("维护完成", this);
|
//Province = CurrentUser.Province;
|
//City = CurrentUser.City;
|
//County = CurrentUser.County;
|
//BindData();
|
|
if(IsWeihuTixingUrl)
|
JavaScript.RefreshDIVOpener(this);
|
#endregion
|
|
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
if (IsWeihuTixingUrl)
|
JavaScript.RefreshDIVOpener(this);
|
}
|
}
|
}
|
}
|