/// <summary> /// 修改来源 /// </summary> void SourceUpdate() { MLMGC.Security.EnterprisePage ep = new MLMGC.Security.EnterprisePage(true); int sourceid = int.Parse(nv["sourceid"]); string code = nv["code"]; string name = nv["name"]; string putin = nv["putin"]; string intro = nv["intro"]; E_Source data = new E_Source(); data.EnterpriseID = ep.EnterpriceID; data.SourceID = sourceid; data.SourceCode = code; data.SourceName = name; if (putin != null) { data.Putin = Convert.ToInt32(putin); } data.Intro = intro; bool b = new T_Source().Update(data); new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = ep.EnterpriceID, UserID = ep.UserID, LogTitle = "修改来源", IP = MLMGC.COMP.Requests.GetRealIP() }); HttpContext.Current.Response.Write(b ? "1" : "0"); }
/// <summary> /// 修改来源 /// </summary> void SourceUpdate() { MLMGC.Security.PersonalPage pp = new MLMGC.Security.PersonalPage(true); int sourceid = int.Parse(nv["sourceid"]); string name = nv["name"]; int putin; if (!int.TryParse(nv["putin"], out putin)) { HttpContext.Current.Response.Write("参数错误"); return; } string intro = nv["intro"]; E_Source data = new E_Source(); data.PersonalID = pp.PersonalID; data.SourceID = sourceid; data.SourceCode = ""; data.SourceName = name; data.Putin = putin; data.Intro = intro; bool b = new T_Source().Update(data); HttpContext.Current.Response.Write(b ? "1" : "0"); }
/// <summary> /// 录入新来源 /// </summary> void SourceAdd() { MLMGC.Security.EnterprisePage ep = new MLMGC.Security.EnterprisePage(true); string code = nv["code"]; string name = nv["name"]; string putin = nv["putin"]; string intro = nv["intro"]; E_Source data = new E_Source(); data.EnterpriseID = ep.EnterpriceID; data.SourceID = 0; data.SourceCode = code; data.SourceName = name; //if (!string.IsNullOrEmpty(putin)) //{ // data.Putin = Convert.ToInt32(putin); //} int num; if (!int.TryParse(putin, out num)) { HttpContext.Current.Response.Write("参数错误"); return; } data.Putin = num; data.Intro = intro; int areaid = new T_Source().Add(data); new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = ep.EnterpriceID, UserID = ep.UserID, LogTitle = "添加来源", IP = MLMGC.COMP.Requests.GetRealIP() }); HttpContext.Current.Response.Write(areaid); }
/// <summary> /// 录入新来源 /// </summary> void SourceAdd() { MLMGC.Security.PersonalPage pp = new MLMGC.Security.PersonalPage(true); string name = nv["name"]; int putin; if (!int.TryParse(nv["putin"], out putin)) { HttpContext.Current.Response.Write("参数错误"); return; } string intro = nv["intro"]; E_Source data = new E_Source(); data.PersonalID = pp.PersonalID; data.SourceID = 0; data.SourceCode = ""; data.SourceName = name; data.Putin = putin; data.Intro = intro; int areaid = new T_Source().Add(data); HttpContext.Current.Response.Write(areaid); }
/// <summary> /// 删除来源 /// </summary> void SourceDelete() { MLMGC.Security.PersonalPage pp = new MLMGC.Security.PersonalPage(true); int sourceid = int.Parse(nv["sourceid"]); E_Source data = new E_Source(); data.PersonalID = pp.PersonalID; data.SourceID = sourceid; bool b = new T_Source().Delete(data); HttpContext.Current.Response.Write(b ? "1" : "0"); }
/// <summary> /// 来源是否存在 /// </summary> void SourceExists() { MLMGC.Security.EnterprisePage ep = new MLMGC.Security.EnterprisePage(true); int sourceid = int.Parse(nv["sourceid"]); string code = nv["code"]; E_Source data = new E_Source(); data.EnterpriseID = ep.EnterpriceID; data.SourceID = sourceid; data.SourceCode = code; bool b = new T_Source().Exists(data); HttpContext.Current.Response.Write(b ? "1" : "0"); }
/// <summary> /// 来源是否存在 /// </summary> void SourceExists() { MLMGC.Security.PersonalPage pp = new MLMGC.Security.PersonalPage(true); int sourceid = int.Parse(nv["sourceid"]); string name = nv["name"]; E_Source data = new E_Source(); data.PersonalID = pp.PersonalID; data.SourceID = sourceid; data.SourceName = name; bool b = new T_Source().Exists(data); HttpContext.Current.Response.Write(b ? "1" : "0"); }
/// <summary> /// 删除来源 /// </summary> void SourceDelete() { MLMGC.Security.EnterprisePage ep = new MLMGC.Security.EnterprisePage(true); int sourceid = int.Parse(nv["sourceid"]); E_Source data = new E_Source(); data.EnterpriseID = ep.EnterpriceID; data.SourceID = sourceid; bool b = new T_Source().Delete(data); new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = ep.EnterpriceID, UserID = ep.UserID, LogTitle = "删除来源", IP = MLMGC.COMP.Requests.GetRealIP() }); HttpContext.Current.Response.Write(b ? "1" : "0"); }
/// <summary> /// 显示来源信息 /// </summary> void SourceShow() { MLMGC.Security.EnterprisePage ep = new MLMGC.Security.EnterprisePage(true); int sourceid = int.Parse(nv["sourceid"]); E_Source data = new E_Source(); data.EnterpriseID = ep.EnterpriceID; data.SourceID = sourceid; data = new T_Source().GetModel(data); if (data == null) { data = new E_Source(); data.SourceID = 0; } JsonObjectCollection colDR = new JsonObjectCollection(); colDR.Add(new JsonStringValue("id", data.SourceID.ToString())); colDR.Add(new JsonStringValue("code", data.SourceCode)); colDR.Add(new JsonStringValue("name", data.SourceName)); colDR.Add(new JsonStringValue("putin", data.Putin.ToString())); colDR.Add(new JsonStringValue("intro", data.Intro)); HttpContext.Current.Response.Write(colDR.ToString()); }
/// <summary> /// 检查数据是否合法 /// </summary> /// <param name="shtClient">名录信息</param> /// <param name="shtSource">来源信息</param> /// <param name="shtTrade">行业信息</param> /// <param name="shtArea">地区信息</param> /// <returns></returns> protected bool Check(HSSFSheet shtClient) { string name, sourcecode, tradecode, areacode; T_Area bllArea = new T_Area(); T_Source bllSource = new T_Source(); T_Trade bllTrade = new T_Trade(); T_ClientInfo bll = new T_ClientInfo(); bool b = true; int count = 0; DataTable dt = null; //------检查名录信息是否合法 if (b && CheckSheet(shtClient, strClientName, 16))//判断名录信息表是否合法 { //-----检查名称是否已经存在 count = shtClient.LastRowNum; for (int i = 1; i <= count; ++i)//从第2行开始 { if (ISCheckRowStrNullOrEmpty(i, shtClient)) { continue; } name = GetCellValue(shtClient.GetRow(i).GetCell(0)); //名称 sourcecode = GetCellValue(shtClient.GetRow(i).GetCell(12)); //来源 tradecode = GetCellValue(shtClient.GetRow(i).GetCell(13)); //行业 areacode = GetCellValue(shtClient.GetRow(i).GetCell(14)); //地区 if (string.IsNullOrWhiteSpace(name)) { _result.Add(string.Format("名录名录为空! 位置[{0}]中,第{1}行", strClientName, i)); b = false; continue; } dt = bll.Exists(new E_ClientInfo() { EnterpriseID = _enterpriseid, ClientName = name, ClientInfoID = 0 }); if (dt == null || dt.Rows.Count == 0) { _result.Add("出错了!"); b = false; continue; } if (dt.Rows[0]["Flag"].ToString() != "-1") { _result.Add(string.Format("[{0}]已经在数据库中存在! 位置[{1}]中,第{2}行", name, strClientName, i)); b = false; } //--------判断属性是否完成-------- //判断来源 if (!string.IsNullOrEmpty(sourcecode) && !bllSource.Exists(new E_Source() { EnterpriseID = _enterpriseid, SourceCode = sourcecode, SourceID = 0 })) { _result.Add("无来源编码:" + sourcecode); b = false; } //判断行业 if (!string.IsNullOrEmpty(tradecode) && !bllTrade.Exists(new E_Trade() { EnterpriseID = _enterpriseid, TradeCode = tradecode, TradeID = 0 })) { _result.Add("无行业编码:" + tradecode); b = false; } //判断地区 if (!string.IsNullOrEmpty(areacode) && !bllArea.Exists(new E_Area() { EnterpriseID = _enterpriseid, AreaCode = areacode, AreaID = 0 })) { _result.Add("无地区编码:" + areacode); b = false; } } } else { return(false); } return(b); }