protected override void OnInit(EventArgs e) { if (string.IsNullOrWhiteSpace(Request["goodsId"]) && string.IsNullOrWhiteSpace(Request["goodsInfoId"])) { Response.Redirect("~/index.aspx", true); } else { if (!string.IsNullOrEmpty(Request["comid"])) { compId = Convert.ToInt32(Request["comid"]); } if (!string.IsNullOrWhiteSpace(Request["goodsId"])) { goodsId = Convert.ToInt32(Request["goodsId"]); } if (!string.IsNullOrWhiteSpace(Request["goodsInfoId"])) { goodsInfoId = Convert.ToInt32(Request["goodsInfoId"]); } if (!string.IsNullOrWhiteSpace(Request["ycid"])) { this.hidycId.Value = Request["ycid"].ToString(); Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(Request["ycid"].ToString().ToInt(0)); if (cmModel != null) { this.hidycId.Attributes.Add("yc-tip", cmModel.CompID.ToString()); // 判断是否厂商自己申请自己 LoginModel uModel = null; if (HttpContext.Current.Session["UserModel"] is LoginModel) { uModel = HttpContext.Current.Session["UserModel"] as LoginModel; if (LoginModel.GetUserCompID(uModel.UserID.ToString()) == cmModel.CompID) { yc_CompT = "1"; } } } this.hidCompId.Value = Request["comid"].ToString(); } if (goodsInfoId != 0) { Hi.Model.BD_GoodsInfo info = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); goodsId = info == null ? 0 : info.GoodsID; } if (!string.IsNullOrWhiteSpace(Request["page"])) { page = Convert.ToInt32(Request["page"]); } } }
/// <summary> /// 上架 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnShangjia_Click(object sender, EventArgs e) { if (KeyID != 0) { Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(this.KeyID); cmModel.IsEnabled = 1; cmModel.modifyuser = this.UserID; cmModel.ts = DateTime.Now; cmModel.CreateDate = DateTime.Now; new Hi.BLL.YZT_CMerchants().Update(cmModel); bind(); } }
/// <summary> /// 下架 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnXianjia_Click(object sender, EventArgs e) { if (KeyID != 0) { Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(this.KeyID); cmModel.IsEnabled = 0; cmModel.modifyuser = this.UserID; cmModel.ts = DateTime.Now; new Hi.BLL.YZT_CMerchants().Update(cmModel); bind(); //工商四元素 //GetBusines bu = new GetBusines(); //string ss = bu.GetBus("", "", "", ""); } }
/// <summary> /// 获取单号 /// </summary> /// <returns></returns> public string GetNo() { string title = string.Empty; string no = string.Empty; int ID = new Hi.BLL.YZT_CMerchants().GetMaxId(); if (ID < 1) { no = DateTime.Now.ToString("yyyyMMdd") + "000001"; } else { no = new Hi.BLL.YZT_CMerchants().GetModel(ID).CMCode; } int num = no.Length >= 8 ? Convert.ToInt32(no.Substring(8)) + 1 : 1; if (num < 10) { no = "00000" + num; } else if (num < 100) { no = "0000" + num; } else if (num < 1000) { no = "000" + num.ToString(); } else if (num < 10000) { no = "00" + num.ToString(); } else if (num < 100000) { no = "0" + num.ToString(); } else { no = num.ToString(); } string No = title + DateTime.Now.ToString("yyyyMMdd") + no; return(No); }
/// <summary> /// 招商信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bind() { if (KeyID != 0) { Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(this.KeyID); this.lblCMCode.InnerText = cmModel.CMCode; this.lblCMName.InnerText = cmModel.CMName; this.lblCompName.InnerText = Common.GetCompValue(cmModel.CompID, "CompName").ToString(); this.lblGoodsCode.InnerText = Common.GetGoodsName(cmModel.GoodsID.ToString(), "GoodsCode"); this.lblGoodsName.InnerText = Common.GetGoodsName(cmModel.GoodsID.ToString(), "GoodsName"); this.lblRemark.InnerText = cmModel.Remark; this.lblValueInfo.InnerText = Common.GetGoodsInfo(cmModel.GoodsID.ToString()); this.lblInvalidDate.InnerText = cmModel.InvalidDate == DateTime.MinValue ? "" : cmModel.InvalidDate.ToString("yyyy-MM-dd"); this.lblForceDate.InnerText = cmModel.ForceDate == DateTime.MinValue ? "" : cmModel.ForceDate.ToString("yyyy-MM-dd"); if (cmModel.ProvideData.IndexOf("1") > -1) { this.lblchk1.Visible = true; this.chk1.Checked = true; } if (cmModel.ProvideData.IndexOf("2") > -1) { this.lblchk2.Visible = true; this.chk2.Checked = true; } if (cmModel.ProvideData.IndexOf("3") > -1) { this.lblchk3.Visible = true; this.chk3.Checked = true; } if (cmModel.ProvideData.IndexOf("4") > -1) { this.lblchk4.Visible = true; this.chk4.Checked = true; } //判断是否已存在通过的代理商 //if (Common.isFC(KeyID.ToString(), cmModel.CompID.ToString())) //{ // this.btnCo.Visible = false; //} } }
/// <summary> /// 招商信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bind() { if (KeyID != 0) { Hi.Model.YZT_FirstCamp fcmodel = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID); if (fcmodel != null) { //需要上传的资料 string ProvideData = new Hi.BLL.YZT_CMerchants().GetModel(fcmodel.CMID).ProvideData; this.hidProvideData.Value = ProvideData; hidcompID.Value = fcmodel.CompID.ToString(); this.txtHtname.Value = new Hi.BLL.SYS_Hospital().GetModel(fcmodel.HtID).HospitalName; this.txtInvalidDate.Value = fcmodel.InvalidDate == DateTime.MinValue ? "" : fcmodel.InvalidDate.ToString("yyyy-MM-dd"); this.txtForceDate.Value = fcmodel.ForceDate == DateTime.MinValue ? "" : fcmodel.ForceDate.ToString("yyyy-MM-dd"); this.txtApplyRemark.Value = fcmodel.Applyremark; } } }
/// <summary> /// 招商信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bind() { if (KeyID != 0) { Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(this.KeyID); bindHt(cmModel.CompID); hidcompID.Value = cmModel.CompID.ToString(); hidProvideData.Value = cmModel.ProvideData; if (cmModel.ProvideData.IndexOf("1") > -1) {//营业执照 this.chk1.Visible = true; } if (cmModel.ProvideData.IndexOf("2") > -1) {//医疗器械经营许可证 this.chk2.Visible = true; } if (cmModel.ProvideData.IndexOf("3") > -1) {//开户许可证 this.chk3.Visible = true; } if (cmModel.ProvideData.IndexOf("4") > -1) {//医疗器械备案 this.chk4.Visible = true; } // 判断是否厂商自己申请自己 LoginModel uModel = null; if (HttpContext.Current.Session["UserModel"] is LoginModel) { uModel = HttpContext.Current.Session["UserModel"] as LoginModel; if (LoginModel.GetUserCompID(uModel.UserID.ToString()) == cmModel.CompID) { tr.Visible = false; } } } }
/// <summary> /// 招商信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bind() { if (KeyID != 0) { Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(this.KeyID); this.hidGoodsID.Value = cmModel.GoodsID.ToString(); //this.txtCMCode.Value = cmModel.CMCode; this.txtCMName.Value = cmModel.CMName; this.txtGoodsCode.Value = Common.GetGoodsName(cmModel.GoodsID.ToString(), "GoodsCode"); this.txtGoodsName.Value = Common.GetGoodsName(cmModel.GoodsID.ToString(), "GoodsName"); this.OrderNote.Value = cmModel.Remark; this.txtValueInfo.Value = cmModel.ValueInfo; this.txtInvalidDate.Value = cmModel.InvalidDate == DateTime.MinValue ? "" : cmModel.InvalidDate.ToString("yyyy-MM-dd"); this.txtForceDate.Value = cmModel.ForceDate == DateTime.MinValue ? "" : cmModel.ForceDate.ToString("yyyy-MM-dd"); this.txtCategoryID.Value = Common.GetCategoryName(Common.GetGoodsName(cmModel.GoodsID.ToString(), "CategoryID")); this.hidCategoryID.Value = cmModel.CategoryID.ToString(); this.ddrtype.Value = cmModel.Type.ToString(); if (cmModel.Type.ToString() == "2" || cmModel.Type.ToString() == "3") { string sql = @"select cm.ID,d.DisID,dis.DisName,a.AreaID,da.AreaName,a.Province,a.City,a.Area from YZT_CMerchants cm left join YZT_FCArea a on cm.ID=a.CMID left join BD_DisArea da on a.AreaID=da.ID left join YZT_FCDis d left join BD_Distributor dis on d.DisID=dis.ID on cm.ID=d.CMID where cm.ID=" + this.KeyID; string fc = string.Empty; string fcid = string.Empty; DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0]; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { if (cmModel.Type.ToString() == "2") { fc += fc == "" ? item["Province"] + "|" + item["City"] + "|" + item["Area"] : "," + item["Province"] + "|" + item["City"] + "|" + item["Area"]; fcid += fcid == "" ? item["Province"] + "|" + item["City"] + "|" + item["Area"] : "," + item["Province"] + "|" + item["City"] + "|" + item["Area"]; } else { fc += fc == "" ? item["DisName"] : "," + item["DisName"]; fcid += fcid == "" ? item["ID"] : "," + item["ID"]; } } } this.txtFC.Value = fc; this.hidfc.Value = fcid; this.selType.Attributes.Add("class", "lb fl"); } if (cmModel.ProvideData.IndexOf("1") > -1) { this.chk1.Checked = true; } if (cmModel.ProvideData.IndexOf("2") > -1) { this.chk2.Checked = true; } if (cmModel.ProvideData.IndexOf("3") > -1) { this.chk3.Checked = true; } if (cmModel.ProvideData.IndexOf("4") > -1) { this.chk4.Checked = true; } } }
/// <summary> /// 新增招商信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { Hi.Model.YZT_CMerchants cmModel = null; string [] ProvideData = new string[4]; if (this.chk1.Checked) { ProvideData[0] = "1"; } if (this.chk2.Checked) { ProvideData[1] = "2"; } if (this.chk3.Checked) { ProvideData[2] = "3"; } if (this.chk4.Checked) { ProvideData[3] = "4"; } if (KeyID != 0) { cmModel = new Hi.BLL.YZT_CMerchants().GetModel(this.KeyID); SqlTransaction Tran = null; try { Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); if ("2".Equals(cmModel.Type.ToString())) { if (!new Hi.BLL.YZT_FCArea().CMDelete(this.KeyID, Tran)) { //Tran.Rollback(); //return; } } else if ("3".Equals(cmModel.Type.ToString())) { if (!new Hi.BLL.YZT_FCDis().CMDelete(this.KeyID, Tran)) { //Tran.Rollback(); //return; } } //cmModel.CMCode = this.txtCMCode.Value.Trim(); cmModel.CMName = this.txtCMName.Value.Trim(); cmModel.GoodsID = this.hidGoodsID.Value.ToInt(0); cmModel.GoodsCode = this.txtGoodsCode.Value.Trim(); cmModel.GoodsName = this.txtGoodsName.Value.Trim(); cmModel.Remark = this.OrderNote.Value.Trim(); cmModel.ValueInfo = this.txtValueInfo.Value.Trim(); cmModel.InvalidDate = this.txtInvalidDate.Value != "" ? Convert.ToDateTime(this.txtInvalidDate.Value.Trim()) : DateTime.MinValue; cmModel.ForceDate = this.txtForceDate.Value != "" ? Convert.ToDateTime(this.txtForceDate.Value.Trim()) : DateTime.MinValue; cmModel.ProvideData = string.Join(",", ProvideData); cmModel.CategoryID = this.hidCategoryID.Value.Trim().ToInt(0); cmModel.Type = ddrtype.Value.ToString().ToInt(0); cmModel.IsEnabled = 0; cmModel.ts = DateTime.Now; cmModel.modifyuser = this.UserID; string fc = this.hidfc.Value; if (new Hi.BLL.YZT_CMerchants().Update(cmModel, Tran)) { if (!"".Equals(fc)) { string[] fcval = fc.Split(new char[] { ',' }); if (ddrtype.Value.ToString() == "2") { //指定区域 Hi.Model.YZT_FCArea areaModel = null; foreach (var item in fcval) { string[] fcvals = item.ToString().Split(new char[] { '|' }); areaModel = new Hi.Model.YZT_FCArea(); //areaModel.AreaID = item.ToInt(0); areaModel.Province = fcvals[0] + ""; areaModel.City = fcvals[1] + ""; areaModel.Area = fcvals[2] + ""; areaModel.CMID = this.KeyID; areaModel.CompID = this.CompID; areaModel.ts = DateTime.Now; areaModel.CreateDate = DateTime.Now; areaModel.CreateUserID = this.UserID; areaModel.modifyuser = this.UserID; new Hi.BLL.YZT_FCArea().Add(areaModel, Tran); } } else if (ddrtype.Value.ToString() == "3") { //指定代理商 Hi.Model.YZT_FCDis fcdisModel = null; foreach (var item in fcval) { fcdisModel = new Hi.Model.YZT_FCDis(); fcdisModel.DisID = item.ToInt(0); fcdisModel.CMID = this.KeyID; fcdisModel.CompID = this.CompID; fcdisModel.ts = DateTime.Now; fcdisModel.CreateDate = DateTime.Now; fcdisModel.CreateUserID = this.UserID; fcdisModel.modifyuser = this.UserID; new Hi.BLL.YZT_FCDis().Add(fcdisModel, Tran); } } } Tran.Commit(); Response.Redirect("CMerchantsInfo.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey)); } else { Tran.Rollback(); } } catch (Exception) { //Tran.Rollback(); throw; } } else { cmModel = new Hi.Model.YZT_CMerchants(); cmModel.CompID = this.CompID; cmModel.CMCode = GetNo(); //this.txtCMCode.Value.Trim(); cmModel.CMName = this.txtCMName.Value.Trim(); cmModel.GoodsCode = this.txtGoodsCode.Value.Trim(); cmModel.GoodsName = this.txtGoodsName.Value.Trim(); cmModel.Remark = this.OrderNote.Value.Trim(); cmModel.ValueInfo = this.txtValueInfo.Value.Trim(); cmModel.InvalidDate = this.txtInvalidDate.Value != "" ? Convert.ToDateTime(this.txtInvalidDate.Value.Trim()) : DateTime.MinValue; cmModel.ForceDate = this.txtForceDate.Value != "" ? Convert.ToDateTime(this.txtForceDate.Value.Trim()) : DateTime.MinValue; cmModel.ProvideData = string.Join(",", ProvideData); cmModel.CategoryID = this.txtCategoryID.Value.Trim().ToInt(0); cmModel.Type = ddrtype.Value.ToString().ToInt(0); cmModel.IsEnabled = 0; cmModel.GoodsID = this.hidGoodsID.Value.ToInt(0); cmModel.ts = DateTime.Now; cmModel.CreateDate = DateTime.Now; cmModel.CreateUserID = this.UserID; cmModel.modifyuser = this.UserID; string fc = this.hidfc.Value; SqlTransaction Tran = null; try { Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); int id = new Hi.BLL.YZT_CMerchants().Add(cmModel, Tran); if (id > 0) { if (!"".Equals(fc)) { string[] fcval = fc.Split(new char[] { ',' }); if (ddrtype.Value.ToString() == "2") { //指定区域 Hi.Model.YZT_FCArea areaModel = null; foreach (var item in fcval) { string[] fcvals = item.ToString().Split(new char[] { '|' }); areaModel = new Hi.Model.YZT_FCArea(); //areaModel.AreaID = item.ToInt(0); areaModel.Province = fcvals[0] + ""; areaModel.City = fcvals[1] + ""; areaModel.Area = fcvals[2] + ""; areaModel.CMID = id; areaModel.CompID = this.CompID; areaModel.ts = DateTime.Now; areaModel.CreateDate = DateTime.Now; areaModel.CreateUserID = this.UserID; areaModel.modifyuser = this.UserID; new Hi.BLL.YZT_FCArea().Add(areaModel, Tran); } } else if (ddrtype.Value.ToString() == "3") { //指定代理商 Hi.Model.YZT_FCDis fcdisModel = null; foreach (var item in fcval) { fcdisModel = new Hi.Model.YZT_FCDis(); fcdisModel.DisID = item.ToInt(0); fcdisModel.CMID = id; fcdisModel.CompID = this.CompID; fcdisModel.ts = DateTime.Now; fcdisModel.CreateDate = DateTime.Now; fcdisModel.CreateUserID = this.UserID; fcdisModel.modifyuser = this.UserID; new Hi.BLL.YZT_FCDis().Add(fcdisModel, Tran); } } } Tran.Commit(); Response.Redirect("CMerchantsInfo.aspx?KeyID=" + Common.DesEncrypt(id.ToString(), Common.EncryptKey)); } else { Tran.Rollback(); } } catch (Exception) { //Tran.Rollback(); throw; } } }
public static string Edit(string KeyID, string CompID, string DisID, string UserID, string HtID, string ForceDate, string InvalidDate, string HidFfileName1, string validDate1, string HidFfileName2, string validDate2, string HidFfileName3, string validDate3, string HidFfileName4, string validDate4, string ApplyRemark) { // Common.ResultMessage Msg = new Common.ResultMessage(); Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(KeyID.ToInt(0)); Hi.Model.YZT_FirstCamp firstcamp = new Hi.Model.YZT_FirstCamp(); //判断是否是该厂商的代理商 List <Hi.Model.SYS_CompUser> compulist = new Hi.BLL.SYS_CompUser().GetList("", " UserID=" + UserID + " and CompID=" + CompID + " and DisID=" + DisID + "", ""); Hi.Model.SYS_Users usersModel = new Hi.BLL.SYS_Users().GetModel(UserID); //首营信息 string sql = "select an.*,fc.ID from YZT_Annex an left join YZT_FCmaterials fc on an.fcID =fc.ID and an.fileAlias in (4) and an.type in(5,7,8,9) where fc.DisID=" + DisID + " and ISNULL(fc.dr,0)=0 and fc.type=2 and ISNULL(an.dr,0)=0"; DataTable dt = SqlHelper.GetTable(SqlHelper.LocalSqlServer, sql); LoginModel uModel = null; if (HttpContext.Current.Session["UserModel"] is LoginModel) { uModel = HttpContext.Current.Session["UserModel"] as LoginModel; } SqlTransaction Tran = null; try { Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); if (DisID == "0") { Hi.Model.BD_Distributor Distributor = new Hi.Model.BD_Distributor(); Distributor.CompID = 0; Distributor.DisName = uModel.CompName; Distributor.IsEnabled = 1; Distributor.Paypwd = Util.md5("123456"); Distributor.Phone = uModel.Phone; Distributor.AuditState = 0; Distributor.CreateDate = DateTime.Now; Distributor.CreateUserID = uModel.UserID; Distributor.ts = DateTime.Now; Distributor.modifyuser = uModel.UserID; Distributor.IsCheck = 0; Distributor.CreditType = 0; Distributor.pic = ""; //Distributor.creditCode = txt_creditCode; Distributor.Leading = ""; Distributor.Licence = ""; int DistributorID = 0; if ((DistributorID = new Hi.BLL.BD_Distributor().Add(Distributor, Tran)) > 0) { DisID = DistributorID.ToString(); //代理商账户登录 Hi.Model.SYS_CompUser compuser = new Hi.Model.SYS_CompUser(); compuser.UserID = UserID.ToInt(0); compuser.CompID = CompID.ToInt(0); compuser.DisID = DisID.ToInt(0); compuser.AreaID = 0; compuser.RoleID = usersModel == null ? 0 : usersModel.RoleID; compuser.CType = 2; compuser.UType = 5; compuser.IsAudit = 0; compuser.IsEnabled = 1; compuser.ts = DateTime.Now; compuser.CreateUserID = UserID.ToInt(0); compuser.modifyuser = UserID.ToInt(0); compuser.CreateDate = DateTime.Now; if (new Hi.BLL.SYS_CompUser().Add(compuser, Tran) <= 0) { Tran.Rollback(); Msg.code = "用户信息添加失败"; return(new JavaScriptSerializer().Serialize(Msg)); } } else { Tran.Rollback(); Msg.code = "用户信息添加失败"; return(new JavaScriptSerializer().Serialize(Msg)); } } else { if (compulist != null && compulist.Count <= 0) { //代理商账户登录 Hi.Model.SYS_CompUser compuser = new Hi.Model.SYS_CompUser(); compuser.UserID = UserID.ToInt(0); compuser.CompID = CompID.ToInt(0); compuser.DisID = DisID.ToInt(0); compuser.AreaID = 0; compuser.RoleID = usersModel == null ? 0 : usersModel.RoleID; compuser.CType = 2; compuser.UType = 5; compuser.IsAudit = 0; compuser.IsEnabled = 1; compuser.ts = DateTime.Now; compuser.CreateUserID = UserID.ToInt(0); compuser.modifyuser = UserID.ToInt(0); compuser.CreateDate = DateTime.Now; if (new Hi.BLL.SYS_CompUser().Add(compuser, Tran) <= 0) { Tran.Rollback(); Msg.code = "用户信息添加失败"; return(new JavaScriptSerializer().Serialize(Msg)); } } } List <Hi.Model.YZT_FirstCamp> fcamplist = new Hi.BLL.YZT_FirstCamp().GetList("", " CMID=" + KeyID + " and DisID=" + DisID + " and CompID=" + CompID + " and HtID=" + HtID, ""); if (fcamplist != null && fcamplist.Count > 0) { Tran.Rollback(); Msg.code = "已申请合作"; return(new JavaScriptSerializer().Serialize(Msg)); } firstcamp.CMID = KeyID.ToInt(0); firstcamp.CompID = CompID.ToInt(0); firstcamp.DisID = DisID.ToInt(0); firstcamp.ForceDate = ForceDate != "" ? Convert.ToDateTime(ForceDate) : DateTime.MinValue; firstcamp.InvalidDate = InvalidDate != "" ? Convert.ToDateTime(InvalidDate) : DateTime.MinValue; firstcamp.State = 0; firstcamp.HtID = HtID.ToInt(0); firstcamp.Applyremark = ApplyRemark; firstcamp.ts = DateTime.Now; firstcamp.modifyuser = UserID.ToInt(0); firstcamp.CreateDate = DateTime.Now; firstcamp.CreateUserID = UserID.ToInt(0); int id = new Hi.BLL.YZT_FirstCamp().Add(firstcamp, Tran); if (id > 0) { //string annexdel = " fileAlias=1 and type in(5,7,9,8) and fcID=" + id; //new Hi.BLL.YZT_Annex().AnnexDelete(annexdel, Tran); List <Hi.Model.YZT_FCmaterials> fcmlist = new Hi.BLL.YZT_FCmaterials().GetList("", "DisID=" + DisID + " and type=2", ""); int fcmid = 0; Hi.Model.YZT_FCmaterials fcmmodel = null; if (fcmlist != null && fcmlist.Count > 0) { fcmmodel = fcmlist[0]; fcmid = fcmmodel.ID; } else { fcmmodel = new Hi.Model.YZT_FCmaterials(); fcmmodel.CompID = 0; fcmmodel.DisID = DisID.ToInt(0); fcmmodel.type = 2; fcmmodel.ts = DateTime.Now; fcmmodel.modifyuser = UserID.ToInt(0); fcmmodel.CreateUserID = UserID.ToInt(0); fcmmodel.CreateDate = DateTime.Now; fcmmodel.dr = 0; fcmid = new Hi.BLL.YZT_FCmaterials().Add(fcmmodel, Tran); } int count = id; string ProvideData = cmModel.ProvideData; if (ProvideData.IndexOf("1") > -1) { //营业执照 Hi.Model.YZT_Annex annexModel1 = insertAnnex(id, 5, HidFfileName1, validDate1, UserID, "1"); count = new Hi.BLL.YZT_Annex().Add(annexModel1, Tran); Hi.Model.YZT_Annex updateModel1 = UpFCmaterials(dt, 5, HidFfileName1, validDate1, UserID); if (updateModel1 != null) { new Hi.BLL.YZT_Annex().Update(updateModel1, Tran); } else { Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 5, HidFfileName1, validDate1, UserID, "4"); new Hi.BLL.YZT_Annex().Add(annexModel11, Tran); } } if (ProvideData.IndexOf("2") > -1) { //医疗器械经营许可证 Hi.Model.YZT_Annex annexModel2 = insertAnnex(id, 7, HidFfileName2, validDate2, UserID, "1"); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); Hi.Model.YZT_Annex updateModel2 = UpFCmaterials(dt, 7, HidFfileName2, validDate2, UserID); if (updateModel2 != null) { new Hi.BLL.YZT_Annex().Update(updateModel2, Tran); } else { Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 7, HidFfileName2, validDate2, UserID, "4"); new Hi.BLL.YZT_Annex().Add(annexModel11, Tran); } } if (ProvideData.IndexOf("3") > -1) { //开户许可证 Hi.Model.YZT_Annex annexModel3 = insertAnnex(id, 9, HidFfileName3, validDate3, UserID, "1"); count = new Hi.BLL.YZT_Annex().Add(annexModel3, Tran); Hi.Model.YZT_Annex updateModel3 = UpFCmaterials(dt, 9, HidFfileName3, validDate3, UserID); if (updateModel3 != null) { new Hi.BLL.YZT_Annex().Update(updateModel3, Tran); } else { Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 9, HidFfileName3, validDate3, UserID, "4"); new Hi.BLL.YZT_Annex().Add(annexModel11, Tran); } } if (ProvideData.IndexOf("4") > -1) { //医疗器械备案 Hi.Model.YZT_Annex annexModel4 = insertAnnex(id, 8, HidFfileName4, validDate4, UserID, "1"); count = new Hi.BLL.YZT_Annex().Add(annexModel4, Tran); Hi.Model.YZT_Annex updateModel4 = UpFCmaterials(dt, 8, HidFfileName4, validDate4, UserID); if (updateModel4 != null) { new Hi.BLL.YZT_Annex().Update(updateModel4, Tran); } else { Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 8, HidFfileName4, validDate4, UserID, "4"); new Hi.BLL.YZT_Annex().Add(annexModel11, Tran); } } if (count <= 0) { Tran.Rollback(); Msg.code = "编辑异常!"; return(new JavaScriptSerializer().Serialize(Msg)); } Tran.Commit(); Msg.result = true; } else { Tran.Rollback(); Msg.code = "编辑异常!"; } } catch (Exception) { Msg.code = "编辑异常!"; throw; } return(new JavaScriptSerializer().Serialize(Msg)); }
public static string Edit(string KeyID, string UserID, string ForceDate, string InvalidDate, string HidFfileName1, string validDate1, string HidFfileName2, string validDate2, string HidFfileName3, string validDate3, string HidFfileName4, string validDate4, string ApplyRemark) { // Common.ResultMessage Msg = new Common.ResultMessage(); Hi.Model.YZT_FirstCamp firstcamp = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID.ToInt(0)); string ProvideData = new Hi.BLL.YZT_CMerchants().GetModel(firstcamp.CMID).ProvideData; //首营信息 string sql = "select an.*,fc.ID from YZT_Annex an left join YZT_FCmaterials fc on an.fcID =fc.ID and an.fileAlias in (4) and an.type in(5,7,8,9) where fc.DisID=" + firstcamp.DisID + " and ISNULL(fc.dr,0)=0 and fc.type=2 and ISNULL(an.dr,0)=0"; DataTable dt = SqlHelper.GetTable(SqlHelper.LocalSqlServer, sql); SqlTransaction Tran = null; try { Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); firstcamp.ForceDate = ForceDate != "" ? Convert.ToDateTime(ForceDate) : DateTime.MinValue; firstcamp.InvalidDate = InvalidDate != "" ? Convert.ToDateTime(InvalidDate) : DateTime.MinValue; firstcamp.Applyremark = ApplyRemark; firstcamp.ts = DateTime.Now; firstcamp.modifyuser = UserID.ToInt(0); bool id = new Hi.BLL.YZT_FirstCamp().Update(firstcamp, Tran); if (id) { string annexdel = " fileAlias=1 and type in(5,7,9,8) and fcID=" + KeyID; new Hi.BLL.YZT_Annex().AnnexDelete(annexdel, Tran); List <Hi.Model.YZT_FCmaterials> fcmlist = new Hi.BLL.YZT_FCmaterials().GetList("", " type=2 and DisID=" + firstcamp.DisID, ""); int fcmid = 0; Hi.Model.YZT_FCmaterials fcmmodel = null; if (fcmlist != null && fcmlist.Count > 0) { fcmmodel = fcmlist[0]; fcmid = fcmmodel.ID; } else { fcmmodel = new Hi.Model.YZT_FCmaterials(); fcmmodel.CompID = 0; fcmmodel.DisID = firstcamp.DisID; fcmmodel.type = 2; fcmmodel.ts = DateTime.Now; fcmmodel.modifyuser = UserID.ToInt(0); fcmmodel.CreateUserID = UserID.ToInt(0); fcmmodel.CreateDate = DateTime.Now; fcmmodel.dr = 0; fcmid = new Hi.BLL.YZT_FCmaterials().Add(fcmmodel, Tran); } bool count = id; if (ProvideData.IndexOf("1") > -1) { //营业执照 Hi.Model.YZT_Annex annexModel1 = insertAnnex(KeyID.ToInt(0), 5, HidFfileName1, validDate1, UserID, "1"); count = new Hi.BLL.YZT_Annex().Add(annexModel1, Tran) > 0; Hi.Model.YZT_Annex updateModel1 = UpFCmaterials(dt, 5, HidFfileName1, validDate1, UserID); if (updateModel1 != null) { new Hi.BLL.YZT_Annex().Update(updateModel1, Tran); } else { Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 5, HidFfileName1, validDate1, UserID, "4"); new Hi.BLL.YZT_Annex().Add(annexModel11, Tran); } } if (ProvideData.IndexOf("2") > -1) { //医疗器械经营许可证 Hi.Model.YZT_Annex annexModel2 = insertAnnex(KeyID.ToInt(0), 7, HidFfileName2, validDate2, UserID, "1"); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran) > 0; Hi.Model.YZT_Annex updateModel2 = UpFCmaterials(dt, 7, HidFfileName2, validDate2, UserID); if (updateModel2 != null) { new Hi.BLL.YZT_Annex().Update(updateModel2, Tran); } else { Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 7, HidFfileName2, validDate2, UserID, "4"); new Hi.BLL.YZT_Annex().Add(annexModel11, Tran); } } if (ProvideData.IndexOf("3") > -1) { //开户许可证 Hi.Model.YZT_Annex annexModel3 = insertAnnex(KeyID.ToInt(0), 9, HidFfileName3, validDate3, UserID, "1"); count = new Hi.BLL.YZT_Annex().Add(annexModel3, Tran) > 0; Hi.Model.YZT_Annex updateModel3 = UpFCmaterials(dt, 9, HidFfileName3, validDate3, UserID); if (updateModel3 != null) { new Hi.BLL.YZT_Annex().Update(updateModel3, Tran); } else { Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 9, HidFfileName3, validDate3, UserID, "4"); new Hi.BLL.YZT_Annex().Add(annexModel11, Tran); } } if (ProvideData.IndexOf("4") > -1) { //医疗器械备案 Hi.Model.YZT_Annex annexModel4 = insertAnnex(KeyID.ToInt(0), 8, HidFfileName4, validDate4, UserID, "1"); count = new Hi.BLL.YZT_Annex().Add(annexModel4, Tran) > 0; Hi.Model.YZT_Annex updateModel4 = UpFCmaterials(dt, 8, HidFfileName4, validDate4, UserID); if (updateModel4 != null) { new Hi.BLL.YZT_Annex().Update(updateModel4, Tran); } else { Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 8, HidFfileName4, validDate4, UserID, "4"); new Hi.BLL.YZT_Annex().Add(annexModel11, Tran); } } if (count) { Tran.Commit(); Msg.result = true; } else { Tran.Rollback(); Msg.code = "编辑异常!"; } } else { Tran.Rollback(); Msg.code = "编辑异常!"; } } catch (Exception) { Msg.code = "编辑异常!"; throw; } return(new JavaScriptSerializer().Serialize(Msg)); }
/// <summary> /// 招商信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bind() { if (KeyID != 0) { Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(this.KeyID); this.txtCMCode.Value = cmModel.CMCode; this.txtCMName.Value = cmModel.CMName; this.txtGoodsCode.Value = Common.GetGoodsName(cmModel.GoodsID.ToString(), "GoodsCode"); this.txtGoodsName.Value = Common.GetGoodsName(cmModel.GoodsID.ToString(), "GoodsName"); this.txtRemark.Value = cmModel.Remark; this.txtValueInfo.Value = Common.GetGoodsInfo(cmModel.GoodsID.ToString()); this.txtInvalidDate.Value = cmModel.InvalidDate == DateTime.MinValue ? "" : cmModel.InvalidDate.ToString("yyyy-MM-dd"); this.txtForceDate.Value = cmModel.ForceDate == DateTime.MinValue ? "" : cmModel.ForceDate.ToString("yyyy-MM-dd"); this.txtCategoryID.Value = Common.GetCategoryName(Common.GetGoodsName(cmModel.GoodsID.ToString(), "CategoryID")); this.ddrtype.Value = cmModel.Type.ToString(); if (cmModel.ProvideData.IndexOf("1") > -1) { this.chk1.Checked = true; this.lblchk1.Visible = true; } if (cmModel.ProvideData.IndexOf("2") > -1) { this.lblchk2.Visible = true; this.chk2.Checked = true; } if (cmModel.ProvideData.IndexOf("3") > -1) { this.lblchk3.Visible = true; this.chk3.Checked = true; } if (cmModel.ProvideData.IndexOf("4") > -1) { this.lblchk4.Visible = true; this.chk4.Checked = true; } string strwhere = ""; if (ViewState["strwhere"] != null) { strwhere = ViewState["strwhere"].ToString(); } string sql = @"select fc.*,dis.DisName,dis.Principal,dis.Phone,ht.HospitalCode,ht.HospitalName from YZT_FirstCamp fc left join BD_Distributor dis on fc.DisID=dis.ID left join SYS_Hospital ht on fc.HtID=ht.ID where fc.dr=0 and dis.DisName<>'' and fc.CMID=" + this.KeyID + strwhere + " order by State"; DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0]; if (dt != null && dt.Rows.Count > 0) { this.rptFc.DataSource = dt; this.rptFc.DataBind(); } else { this.rptFc.DataSource = null; this.rptFc.DataBind(); } //绑定区域 StringBuilder sbare = new StringBuilder(); List <Hi.Model.BD_DisArea> are = new Hi.BLL.BD_DisArea().GetList("top 12 * ", "isnull(dr,0)=0 and ParentId=0 and CompanyID=" + this.CompID, " SortIndex"); if (are.Count > 0) { sbare.Append("["); int num = 0; foreach (var model in are) { num++; sbare.Append("{code:'" + model.ID + "',value: '" + model.ID + "',label: '" + model.AreaName + "'"); List <Hi.Model.BD_DisArea> aret1 = new Hi.BLL.BD_DisArea().GetList("Areacode,ID,AreaName", "isnull(dr,0)=0 and ParentId=" + model.ID, ""); if (aret1.Count > 0) { sbare.Append(",children: ["); int num2 = 0; foreach (var model2 in aret1) { num2++; sbare.Append("{code:'" + model2.ID + "',value: '" + model2.ID + "',label: '" + model2.AreaName + "'"); List <Hi.Model.BD_DisArea> are3 = new Hi.BLL.BD_DisArea().GetList("Areacode,ID,AreaName", "isnull(dr,0)=0 and ParentId=" + model2.ID, ""); if (are3.Count > 0) { sbare.Append(",children: ["); int num3 = 0; foreach (var item3 in are3) { num3++; if (num3 == are3.Count) { sbare.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.AreaName + "'}"); } else { sbare.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.AreaName + "'},"); } } sbare.Append("]"); } if (num2 == aret1.Count) { sbare.Append("}"); } else { sbare.Append("},"); } } sbare.Append("]"); } if (num == are.Count) { sbare.Append("}"); } else { sbare.Append("},"); } } sbare.Append("]"); DisArea = sbare.ToString(); } } }