public void DataBindLink() { string id = Request.QueryString["cid"]; if (!string.IsNullOrWhiteSpace(id)) { List <Hi.Model.YZT_Annex> AnnexDelList = new Hi.BLL.YZT_Annex().GetList("", " dr=0 and fcID=" + id + " and fileAlias=3", ""); if (AnnexDelList.Count > 0) { string file = ""; foreach (Hi.Model.YZT_Annex item in AnnexDelList) { file = item.fileName; if (!string.IsNullOrEmpty(file)) { LinkButton linkFile = new LinkButton(); linkFile.Click += new EventHandler(Download_Click); if (file.LastIndexOf("_") != -1) { string text = file.Substring(0, file.LastIndexOf("_")) + Path.GetExtension(file); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } else { string text = file.Substring(0, file.LastIndexOf("-")) + Path.GetExtension(file); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } linkFile.Style.Add("margin-right", "5px"); linkFile.Style.Add("text-decoration", "underline"); linkFile.Attributes.Add("fileName", file); HtmlGenericControl div = new HtmlGenericControl("div"); div.Controls.Add(linkFile); HtmlImage img = new HtmlImage(); img.Src = "../../images/icon_del.png"; img.Attributes.Add("title", "删除附件"); img.Attributes.Add("onclick", "AnnexDel(this,'Dis'," + KeyID + ",'" + file + "')"); div.Controls.Add(img); DFile.Controls.Add(div); } } } } }
/// <summary> /// 附件绑定 /// </summary> public void DataBindLink() { string fid = Request.QueryString["fid"]; if (!string.IsNullOrWhiteSpace(fid)) { List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + fid + " and dr=0 and fileAlias='4'", ""); foreach (Hi.Model.YZT_Annex item in annexList) { if (!string.IsNullOrEmpty(item.fileName)) { LinkButton linkFile = new LinkButton(); linkFile.Click += new EventHandler(Download_Click); if (item.fileName.LastIndexOf("_") != -1) { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } else { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } linkFile.Style.Add("text-decoration", "underline"); linkFile.Attributes.Add("fileName", item.fileName); HtmlGenericControl div = new HtmlGenericControl("div"); div.Controls.Add(linkFile); if (item.type == 5) { UpFileText.Controls.Add(div); } else { UpFileText2.Controls.Add(div); } } } } }
public void DataBindLink() { string LibraryID = Request.QueryString["KeyID"]; if (!string.IsNullOrWhiteSpace(LibraryID)) { List <Hi.Model.YZT_Annex> AnnexDelList = new Hi.BLL.YZT_Annex().GetList("", " dr=0 and fcID=" + LibraryID + " and fileAlias=6 and type=11", ""); if (AnnexDelList.Count > 0) { string file = ""; foreach (Hi.Model.YZT_Annex item in AnnexDelList) { file = item.fileName; if (!string.IsNullOrEmpty(file)) { LinkButton linkFile = new LinkButton(); linkFile.Click += new EventHandler(Download_Click); if (file.LastIndexOf("_") != -1) { string text = file.Substring(0, file.LastIndexOf("_")) + Path.GetExtension(file); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } else { string text = file.Substring(0, file.LastIndexOf("-")) + Path.GetExtension(file); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } linkFile.Style.Add("margin-right", "5px"); linkFile.Style.Add("text-decoration", "underline"); linkFile.Attributes.Add("fileName", file); HtmlGenericControl div = new HtmlGenericControl("div"); div.Controls.Add(linkFile); DFile.Controls.Add(div); } } } } }
/// <summary> /// 授权书 /// </summary> /// <param name="fcID"></param> /// <returns></returns> public string Queryannex(string fcID) { List <Hi.Model.YZT_Annex> annlist = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + fcID + " and type=2 and fileAlias='2' ", ""); string str = ""; if (annlist != null && annlist.Count > 0) { str = "<a style=\"cursor: pointer;\" class=\"bt\" title=\"" + annlist[0].fileName + "\" href=\"../../UploadFile/" + annlist[0].fileName + "\" target=\"_blank\">" + Common.MySubstring(annlist[0].fileName, 20, "...") + "</a>"; } return(str); }
/// <summary> /// 附件绑定 /// </summary> public void DataBindLink() { //查询需要提供的资料 List <Hi.Model.YZT_Annex> annexlist = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + this.KeyID + " and fileAlias in (1,2) and dr=0", ""); if (annexlist != null && annexlist.Count > 0) { foreach (Hi.Model.YZT_Annex item in annexlist) { if (!string.IsNullOrEmpty(item.fileName)) { LinkButton linkFile = new LinkButton(); linkFile.Click += new EventHandler(Download_Click); if (item.fileName.LastIndexOf("_") != -1) { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } else { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } linkFile.Style.Add("text-decoration", "underline"); linkFile.Attributes.Add("fileName", item.fileName); HtmlGenericControl div = new HtmlGenericControl("div"); div.Controls.Add(linkFile); if (item.fileAlias == "3") {//合同 this.UpFile1.Visible = true; UpFileText.Controls.Add(div); } } } } }
/// <summary> /// 绑定数据 /// </summary> public void bind() { if (KeyID != 0) { List <Hi.Model.YZT_Annex> annlist = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + this.KeyID + " and type=2 and fileAlias='2' ", ""); if (annlist != null && annlist.Count > 0) { string linkFile = string.Empty; if (annlist[0].fileName.LastIndexOf("_") != -1) { string text = annlist[0].fileName.Substring(0, annlist[0].fileName.LastIndexOf("_")) + Path.GetExtension(annlist[0].fileName); if (text.Length < 15) { linkFile = text; } else { linkFile = text.Substring(0, 15) + "..."; } } else { string text = annlist[0].fileName.Substring(0, annlist[0].fileName.LastIndexOf("-")) + Path.GetExtension(annlist[0].fileName); if (text.Length < 15) { linkFile = text; } else { linkFile = text.Substring(0, 15) + "..."; } } string UpText = string.Format("<dl class=\"teamList\"><dd><a style=\"cursor: pointer;\" class=\"bt\" title=\"" + annlist[0].fileName + "\" href=\"../../UploadFile/" + annlist[0].fileName + "\" download=" + annlist[0].fileName + " target=\"_blank\">" + linkFile + "</a><a class=\"red\" onclick=\"Cancel()\">删除</a></dd></dl>"); this.UpFileText.InnerHtml = UpText; this.HidFfileName.Value = annlist[0].fileName; } } }
/// <summary> /// 修改绑定 /// </summary> /// <param name="type">入库or出库</param> /// <param name="no">单据ID</param> public void Bind() { string ContID = Request.QueryString["cid"]; this.Cid.Value = Request.QueryString["cid"]; if (!string.IsNullOrWhiteSpace(ContID)) { Hi.Model.YZT_Contract contractModel = new Hi.BLL.YZT_Contract().GetModel(Convert.ToInt32(ContID)); if (contractModel != null) { this.txtcontractNO.Value = contractModel.contractNO; this.txtcontractDate.Value = contractModel.contractDate.ToString("yyyy-MM-dd"); this.txtForceDate.Value = contractModel.ForceDate.ToString("yyyy-MM-dd"); this.txtInvalidDate.Value = contractModel.InvalidDate.ToString("yyyy-MM-dd"); this.txtRemark.Value = contractModel.Remark; this.DropDis.SelectedValue = contractModel.DisID.ToString(); this.CState.Value = contractModel.CState.ToString(); } DataTable dt = new Hi.BLL.YZT_ContractDetail().getDataTable(ContID); if (dt.Rows.Count > 0) { tbodyTR.Visible = false; this.RepContractDetail.DataSource = dt; this.RepContractDetail.DataBind(); } List <Hi.Model.YZT_Annex> AnnexDelList = new Hi.BLL.YZT_Annex().GetList("", " dr=0 and fcID=" + ContID + " and fileAlias=3", ""); if (AnnexDelList.Count > 0) { string fileName = ""; foreach (Hi.Model.YZT_Annex item in AnnexDelList) { fileName += item.fileName + ","; } HidFfileName.Value = fileName; } } }
/// <summary> /// 页面数据绑定 /// </summary> public void bind() { string id = Request.QueryString["id"]; if (!string.IsNullOrWhiteSpace(id)) { //修改 Hi.Model.YZT_FCmaterials fCmaterialsModel = new Hi.BLL.YZT_FCmaterials().GetModel(Convert.ToInt32(id)); if (fCmaterialsModel != null) { this.txtRise.Value = fCmaterialsModel.Rise; this.txtContent.Value = fCmaterialsModel.Content; this.txtOBank.Value = fCmaterialsModel.OBank; this.txtOAccount.Value = fCmaterialsModel.OAccount; this.txtTRNumber.Value = fCmaterialsModel.TRNumber; List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + id + " and dr=0 and fileAlias='4'", ""); foreach (Hi.Model.YZT_Annex item in annexList) { if (item.type == 5) { //营业执照绑定 this.HidFfileName.Value = item.fileName; this.validDate.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 6) { //生产许可证绑定 this.HidFfileName2.Value = item.fileName; this.validDate2.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 12) { this.HidFfileName3.Value = item.fileName; this.validDate3.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 13) { this.HidFfileName4.Value = item.fileName; this.validDate4.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 14) { this.HidFfileName5.Value = item.fileName; this.validDate5.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 15) { this.HidFfileName6.Value = item.fileName; this.validDate6.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 16) { this.HidFfileName7.Value = item.fileName; this.validDate7.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 17) { this.HidFfileName8.Value = item.fileName; this.validDate8.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 18) { this.HidFfileName9.Value = item.fileName; this.validDate9.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 19) { this.HidFfileName10.Value = item.fileName; this.validDate10.Value = item.validDate.ToString("yyyy/MM/dd"); } } } } }
/// <summary> /// 确认按钮单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { string HidFfileNameNew = this.HidFfileName.Value.Trim(); //营业执照 附件名称 string HidFfileNameOld = ""; //营业执照 附件旧名称(更新后 需要删除的旧附件) string HidFfileNameNew2 = this.HidFfileName2.Value.Trim(); //生产许可证 附件名称 string HidFfileNameOld2 = ""; //生产许可证 附件旧名称(更新后 需要删除的旧附件) string HidFfileNameNew3 = this.HidFfileName3.Value.Trim(); // 附件名称 string HidFfileNameOld3 = ""; string HidFfileNameNew4 = this.HidFfileName4.Value.Trim();// 附件名称 string HidFfileNameOld4 = ""; string HidFfileNameNew5 = this.HidFfileName5.Value.Trim();// 附件名称 string HidFfileNameOld5 = ""; string HidFfileNameNew6 = this.HidFfileName6.Value.Trim();// 附件名称 string HidFfileNameOld6 = ""; string HidFfileNameNew7 = this.HidFfileName7.Value.Trim();// 附件名称 string HidFfileNameOld7 = ""; string HidFfileNameNew8 = this.HidFfileName8.Value.Trim();// 附件名称 string HidFfileNameOld8 = ""; string HidFfileNameNew9 = this.HidFfileName9.Value.Trim();// 附件名称 string HidFfileNameOld9 = ""; string HidFfileNameNew10 = this.HidFfileName10.Value.Trim();// 附件名称 string HidFfileNameOld10 = ""; Hi.Model.YZT_FCmaterials fCmaterialsModel = null; string id = Request.QueryString["id"]; SqlTransaction Tran = null; try { Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); int fid = 0; //新增 if (string.IsNullOrWhiteSpace(id)) { fCmaterialsModel = new Hi.Model.YZT_FCmaterials(); fCmaterialsModel = getfCmaterialsModel(fCmaterialsModel); fCmaterialsModel.CreateUserID = UserID; fCmaterialsModel.CreateDate = DateTime.Now; fCmaterialsModel.dr = 0; fid = new Hi.BLL.YZT_FCmaterials().Add(fCmaterialsModel, Tran); if (fid > 0) { DateTime time = DateTime.Now; int count = 0; try { count = 1; //新增营业执照附件表 if (!string.IsNullOrWhiteSpace(this.HidFfileName.Value.Trim())) { Hi.Model.YZT_Annex annexModel = insertAnnex(Convert.ToInt32(fid), 5, this.HidFfileName.Value.Trim(), this.validDate.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel, Tran); } if (!string.IsNullOrWhiteSpace(this.HidFfileName2.Value.Trim())) { //新增生产许可证表 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 6, this.HidFfileName2.Value.Trim(), this.validDate2.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } if (!string.IsNullOrWhiteSpace(this.HidFfileName3.Value.Trim())) { //新增税务登记证 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 12, this.HidFfileName3.Value.Trim(), this.validDate3.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } if (!string.IsNullOrWhiteSpace(this.HidFfileName4.Value.Trim())) { //新增开户银行许可证 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 13, this.HidFfileName4.Value.Trim(), this.validDate4.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } if (!string.IsNullOrWhiteSpace(this.HidFfileName5.Value.Trim())) { //新增质量管理体系调查表 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 14, this.HidFfileName5.Value.Trim(), this.validDate5.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } if (!string.IsNullOrWhiteSpace(this.HidFfileName6.Value.Trim())) { //新增GSP/GMP证书 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 15, this.HidFfileName6.Value.Trim(), this.validDate6.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } if (!string.IsNullOrWhiteSpace(this.HidFfileName7.Value.Trim())) { //新增开票信息 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 16, this.HidFfileName7.Value.Trim(), this.validDate7.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } if (!string.IsNullOrWhiteSpace(this.HidFfileName8.Value.Trim())) { //新增企业年报 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 17, this.HidFfileName8.Value.Trim(), this.validDate8.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } if (!string.IsNullOrWhiteSpace(this.HidFfileName9.Value.Trim())) { //新增银行收付款帐号资料 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 18, this.HidFfileName9.Value.Trim(), this.validDate9.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } if (!string.IsNullOrWhiteSpace(this.HidFfileName10.Value.Trim())) { //新增购销合同 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 19, this.HidFfileName10.Value.Trim(), this.validDate10.Value.Trim()); count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } } catch (Exception) { count = 0; } if (count > 0) { Tran.Commit(); Response.Redirect("FCmaterialsInfo.aspx?id=" + fid, true); } else { throw new Exception("新增异常!"); } } else { throw new Exception("新增异常!"); } } else { //修改 fCmaterialsModel = new Hi.BLL.YZT_FCmaterials().GetModel(Convert.ToInt32(id)); fCmaterialsModel = getfCmaterialsModel(fCmaterialsModel); if (new Hi.BLL.YZT_FCmaterials().Update(fCmaterialsModel, Tran)) { DateTime time = DateTime.Now; List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + id + " and dr=0", ""); foreach (Hi.Model.YZT_Annex item in annexList) { item.ts = time; item.modifyuser = UserID; if (item.type == 5) { //营业执照修改 HidFfileNameOld = item.fileName; item.fileName = HidFfileNameNew; if (!string.IsNullOrWhiteSpace(this.validDate.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate.Value.Trim()); } } else if (item.type == 6) { //生产许可证修改 HidFfileNameOld2 = item.fileName; item.fileName = HidFfileNameNew2; if (!string.IsNullOrWhiteSpace(this.validDate2.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate2.Value.Trim()); } } else if (item.type == 12) { //税务登记证修改 HidFfileNameOld3 = item.fileName; item.fileName = HidFfileNameNew3; if (!string.IsNullOrWhiteSpace(this.validDate3.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate3.Value.Trim()); } } else if (item.type == 13) { //开户银行许可证修改 HidFfileNameOld4 = item.fileName; item.fileName = HidFfileNameNew4; if (!string.IsNullOrWhiteSpace(this.validDate4.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate4.Value.Trim()); } } else if (item.type == 14) { //质量管理体系调查表修改 HidFfileNameOld5 = item.fileName; item.fileName = HidFfileNameNew5; if (!string.IsNullOrWhiteSpace(this.validDate5.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate5.Value.Trim()); } } else if (item.type == 15) { //GSP/GMP证书修改 HidFfileNameOld6 = item.fileName; item.fileName = HidFfileNameNew6; if (!string.IsNullOrWhiteSpace(this.validDate6.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate6.Value.Trim()); } } else if (item.type == 16) { //开票信息修改 HidFfileNameOld7 = item.fileName; item.fileName = HidFfileNameNew7; if (!string.IsNullOrWhiteSpace(this.validDate7.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate7.Value.Trim()); } } else if (item.type == 17) { //企业年报修改 HidFfileNameOld8 = item.fileName; item.fileName = HidFfileNameNew8; if (!string.IsNullOrWhiteSpace(this.validDate8.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate8.Value.Trim()); } } else if (item.type == 18) { //银行收付款帐号资料修改 HidFfileNameOld9 = item.fileName; item.fileName = HidFfileNameNew9; if (!string.IsNullOrWhiteSpace(this.validDate9.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate9.Value.Trim()); } } else if (item.type == 19) { //购销合同修改 HidFfileNameOld10 = item.fileName; item.fileName = HidFfileNameNew10; if (!string.IsNullOrWhiteSpace(this.validDate10.Value.Trim())) { item.validDate = Convert.ToDateTime(this.validDate10.Value.Trim()); } } if (!new Hi.BLL.YZT_Annex().Update(item, Tran)) { break; throw new Exception("修改异常!"); } } List <Hi.Model.YZT_Annex> annex1 = annexList.Where(a => a.type == 5).ToList(); if (annex1.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName.Value.Trim())) { //新增营业执照附件表 Hi.Model.YZT_Annex annexModel = insertAnnex(Convert.ToInt32(id), 5, this.HidFfileName.Value.Trim(), this.validDate.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel, Tran); } List <Hi.Model.YZT_Annex> annex2 = annexList.Where(a => a.type == 6).ToList(); if (annex2.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName2.Value.Trim())) { //新增生产许可证表 Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 6, this.HidFfileName2.Value.Trim(), this.validDate2.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex3 = annexList.Where(a => a.type == 12).ToList(); if (annex3.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName3.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 12, this.HidFfileName3.Value.Trim(), this.validDate3.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex4 = annexList.Where(a => a.type == 13).ToList(); if (annex4.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName4.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 13, this.HidFfileName4.Value.Trim(), this.validDate4.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex5 = annexList.Where(a => a.type == 14).ToList(); if (annex5.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName5.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 14, this.HidFfileName5.Value.Trim(), this.validDate5.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex6 = annexList.Where(a => a.type == 15).ToList(); if (annex6.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName6.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 15, this.HidFfileName6.Value.Trim(), this.validDate6.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex7 = annexList.Where(a => a.type == 16).ToList(); if (annex7.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName7.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 16, this.HidFfileName7.Value.Trim(), this.validDate7.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex8 = annexList.Where(a => a.type == 17).ToList(); if (annex8.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName8.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 17, this.HidFfileName8.Value.Trim(), this.validDate8.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex9 = annexList.Where(a => a.type == 18).ToList(); if (annex9.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName9.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 18, this.HidFfileName9.Value.Trim(), this.validDate9.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex10 = annexList.Where(a => a.type == 19).ToList(); if (annex10.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName10.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 19, this.HidFfileName10.Value.Trim(), this.validDate10.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } //删除旧的营业执照附件 if (HidFfileNameOld != HidFfileNameNew) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld); if (file.Exists) { file.Delete(); } } //删除旧的生产许可证 附加 if (HidFfileNameOld2 != HidFfileNameNew2) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld2); if (file.Exists) { file.Delete(); } } if (HidFfileNameOld3 != HidFfileNameNew3) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld3); if (file.Exists) { file.Delete(); } } if (HidFfileNameOld4 != HidFfileNameNew4) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld4); if (file.Exists) { file.Delete(); } } if (HidFfileNameOld5 != HidFfileNameNew5) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld5); if (file.Exists) { file.Delete(); } } if (HidFfileNameOld6 != HidFfileNameNew6) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld6); if (file.Exists) { file.Delete(); } } if (HidFfileNameOld7 != HidFfileNameNew7) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld7); if (file.Exists) { file.Delete(); } } if (HidFfileNameOld8 != HidFfileNameNew8) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld8); if (file.Exists) { file.Delete(); } } if (HidFfileNameOld9 != HidFfileNameNew9) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld9); if (file.Exists) { file.Delete(); } } if (HidFfileNameOld10 != HidFfileNameNew10) { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld10); if (file.Exists) { file.Delete(); } } Tran.Commit(); Response.Redirect("FCmaterialsInfo.aspx?id=" + id, true); } else { throw new Exception("修改异常!"); } } } catch (Exception ex) { if (Tran != null) { if (Tran.Connection != null) { Tran.Rollback(); } } JScript.AlertMethod(this, ex.Message, JScript.IconOption.错误, "function (){ window.location.href=window.location.href; }"); } finally { DBUtility.SqlHelper.ConnectionClose(); } }
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)); }
/// <summary> /// 附件绑定 /// </summary> public void DataBindLink() { this.li1.Visible = false; this.li2.Visible = false; this.li3.Visible = false; this.li4.Visible = false; this.li5.Visible = false; this.li6.Visible = false; this.li7.Visible = false; this.li8.Visible = false; this.li9.Visible = false; this.li10.Visible = false; this.li11.Visible = false; this.li12.Visible = false; string fid = Request.QueryString["id"]; if (!string.IsNullOrWhiteSpace(fid)) { List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + fid + " and dr=0 and fileAlias='4'", ""); foreach (Hi.Model.YZT_Annex item in annexList) { if (!string.IsNullOrEmpty(item.fileName)) { LinkButton linkFile = new LinkButton(); linkFile.Click += new EventHandler(Download_Click); if (item.fileName.LastIndexOf("_") != -1) { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } else { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } linkFile.Style.Add("text-decoration", "underline"); linkFile.Attributes.Add("fileName", item.fileName); HtmlGenericControl div = new HtmlGenericControl("div"); div.Controls.Add(linkFile); if (item.type == 5) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li1.Visible = true; UpFileText.Controls.Add(div); validDate.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 7) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li2.Visible = true; UpFileText2.Controls.Add(div); validDate2.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 8) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li3.Visible = true; UpFileText3.Controls.Add(div); validDate3.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 9) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li4.Visible = true; UpFileText4.Controls.Add(div); validDate4.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 12) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li5.Visible = true; this.HidFfileName3.Value = item.fileName; this.validDate3.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 13) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li6.Visible = true; this.HidFfileName4.Value = item.fileName; this.validDate4.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 14) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li7.Visible = true; this.HidFfileName5.Value = item.fileName; this.validDate5.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 15) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li8.Visible = true; this.HidFfileName6.Value = item.fileName; this.validDate6.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 16) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li9.Visible = true; this.HidFfileName7.Value = item.fileName; this.validDate7.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 17) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li10.Visible = true; this.HidFfileName8.Value = item.fileName; this.validDate8.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 18) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li11.Visible = true; this.HidFfileName9.Value = item.fileName; this.validDate9.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 19) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li12.Visible = true; this.HidFfileName10.Value = item.fileName; this.validDate10.Value = item.validDate.ToString("yyyy/MM/dd"); } } } } } }
public static string Edit(string KeyID, string Remark, string DisAreaID, string CompID, string UserID) { Common.ResultMessage Msg = new Common.ResultMessage(); Hi.Model.YZT_FirstCamp fcmodel = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID.ToInt(0)); List <Hi.Model.YZT_Annex> annlist = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + KeyID + " and type=2 and fileAlias='2' ", ""); if (annlist != null && annlist.Count <= 0) { Msg.code = "请先上传授权书"; } else { if (fcmodel != null) { //判断是否是该厂商的代理商 List <Hi.Model.SYS_CompUser> compulist = new Hi.BLL.SYS_CompUser().GetList("", " UserID=" + fcmodel.CreateUserID + " and CompID=" + CompID + " and DisID=" + fcmodel.DisID + "", ""); Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(CompID.ToInt(0)); string compName = comp == null ? "" : comp.CompName; SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); fcmodel.AreaID = DisAreaID.ToInt(0); fcmodel.Remark = Remark; fcmodel.State = 2; fcmodel.ts = DateTime.Now; if (new Hi.BLL.YZT_FirstCamp().Update(fcmodel, Tran)) { if (compulist != null && compulist.Count <= 0) { Hi.Model.SYS_Users usersModel = new Hi.BLL.SYS_Users().GetModel(fcmodel.CreateUserID); string Phone = usersModel == null ? "" : usersModel.Phone; string UserName = usersModel == null ? "" : usersModel.UserName; Hi.Model.SYS_CompUser compuser = new Hi.Model.SYS_CompUser(); compuser.UserID = fcmodel.CreateUserID; compuser.CompID = CompID.ToInt(0); compuser.DisID = fcmodel.DisID; compuser.AreaID = DisAreaID.ToInt(0); compuser.RoleID = usersModel == null ? 0 : usersModel.RoleID; compuser.CType = 2; compuser.UType = 5; compuser.IsAudit = 2; 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.Commit(); Msg.result = true; GetPhoneCode pc = new GetPhoneCode(); pc.SendConfirm(Phone, compName, UserName); } else { Tran.Rollback(); Msg.code = "用户信息添加失败"; } } else { Hi.Model.SYS_CompUser compuser = compulist[0]; compuser.IsAudit = 2; compuser.AreaID = DisAreaID.ToInt(0); compuser.ts = DateTime.Now; compuser.modifyuser = UserID.ToInt(0); if (new Hi.BLL.SYS_CompUser().Update(compuser, Tran)) { Tran.Commit(); Msg.result = true; Hi.Model.SYS_Users usersModel = new Hi.BLL.SYS_Users().GetModel(compulist[0].UserID); string Phone = usersModel == null ? "" : usersModel.Phone; string UserName = usersModel == null ? "" : usersModel.UserName; GetPhoneCode pc = new GetPhoneCode(); pc.SendConfirm(Phone, compName, UserName); } else { Tran.Rollback(); Msg.code = "用户信息添加失败"; } } } else { Tran.Rollback(); Msg.code = "通过失败"; } } else { Msg.code = "未查找到数据"; } } return(new JavaScriptSerializer().Serialize(Msg)); }
/// <summary> /// 附件绑定 /// </summary> public void DataBindLink() { string id = Request.QueryString["id"]; if (!string.IsNullOrWhiteSpace(id)) { //修改 Hi.Model.YZT_FCmaterials fCmaterialsModel = new Hi.BLL.YZT_FCmaterials().GetModel(Convert.ToInt32(id)); if (fCmaterialsModel != null) { this.txtRise.Value = fCmaterialsModel.Rise; this.txtContent.Value = fCmaterialsModel.Content; this.txtOBank.Value = fCmaterialsModel.OBank; this.txtOAccount.Value = fCmaterialsModel.OAccount; this.txtTRNumber.Value = fCmaterialsModel.TRNumber; } List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + id + " and dr=0 and fileAlias='4'", ""); foreach (Hi.Model.YZT_Annex item in annexList) { if (!string.IsNullOrEmpty(item.fileName)) { LinkButton linkFile = new LinkButton(); linkFile.Click += new EventHandler(Download_Click); if (item.fileName.LastIndexOf("_") != -1) { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } else { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } linkFile.Style.Add("margin-right", "5px"); linkFile.Style.Add("text-decoration", "underline"); linkFile.Attributes.Add("fileName", item.fileName); HtmlGenericControl div = new HtmlGenericControl("div"); div.Controls.Add(linkFile); HtmlImage img = new HtmlImage(); img.Src = "../../images/icon_del.png"; img.Attributes.Add("title", "删除附件"); img.Attributes.Add("onclick", "AnnexDelete()"); img.Attributes.Add("class", "AnnexDelete"); div.Controls.Add(img); if (item.type == 5) { validDate.Value = item.validDate.ToString("yyyy/MM/dd"); HidFfileName.Value = item.fileName; UpFileText.Controls.Add(div); } else if (item.type == 7) { HidFfileName2.Value = item.fileName; validDate2.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText2.Controls.Add(div); } else if (item.type == 8) { HidFfileName3.Value = item.fileName; validDate3.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText3.Controls.Add(div); } else if (item.type == 9) { HidFfileName4.Value = item.fileName; validDate4.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText4.Controls.Add(div); } else if (item.type == 12) { this.HidFfileName11.Value = item.fileName; this.validDate11.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText11.Controls.Add(div); } else if (item.type == 13) { this.HidFfileName12.Value = item.fileName; this.validDate12.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText12.Controls.Add(div); } else if (item.type == 14) { this.HidFfileName5.Value = item.fileName; this.validDate5.Value = item.validDate.ToString("yyyy/MM/dd"); } else if (item.type == 15) { this.HidFfileName6.Value = item.fileName; this.validDate6.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText6.Controls.Add(div); } else if (item.type == 16) { this.HidFfileName7.Value = item.fileName; this.validDate7.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText7.Controls.Add(div); } else if (item.type == 17) { this.HidFfileName8.Value = item.fileName; this.validDate8.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText8.Controls.Add(div); } else if (item.type == 18) { this.HidFfileName9.Value = item.fileName; this.validDate9.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText9.Controls.Add(div); } else if (item.type == 19) { this.HidFfileName10.Value = item.fileName; this.validDate10.Value = item.validDate.ToString("yyyy/MM/dd"); UpFileText10.Controls.Add(div); } } } } }
/// <summary> /// 附件绑定 /// </summary> public void DataBindLink() { List <Hi.Model.YZT_FCmaterials> fCmaterialsList = new Hi.BLL.YZT_FCmaterials().GetList("", " DisID =" + DisID + " and dr=0 ", ""); this.li1.Visible = false; this.li2.Visible = false; this.li3.Visible = false; this.li4.Visible = false; this.li5.Visible = false; this.li6.Visible = false; this.li7.Visible = false; this.li8.Visible = false; this.li9.Visible = false; this.li10.Visible = false; this.li11.Visible = false; this.li12.Visible = false; if (fCmaterialsList.Count > 0) { fid = fCmaterialsList[0].ID; this.txtRise.Value = fCmaterialsList[0].Rise; this.txtContent.Value = fCmaterialsList[0].Content; this.txtOBank.Value = fCmaterialsList[0].OBank; this.txtOAccount.Value = fCmaterialsList[0].OAccount; this.txtTRNumber.Value = fCmaterialsList[0].TRNumber; List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + fCmaterialsList[0].ID + " and dr=0 and fileAlias='4'", ""); foreach (Hi.Model.YZT_Annex item in annexList) { if (!string.IsNullOrEmpty(item.fileName)) { LinkButton linkFile = new LinkButton(); linkFile.Click += new EventHandler(Download_Click); if (item.fileName.LastIndexOf("_") != -1) { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } else { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } linkFile.Style.Add("text-decoration", "underline"); linkFile.Attributes.Add("fileName", item.fileName); HtmlGenericControl div = new HtmlGenericControl("div"); div.Controls.Add(linkFile); if (item.type == 5) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li1.Visible = true; UpFileText.Controls.Add(div); validDate.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 7) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li2.Visible = true; UpFileText2.Controls.Add(div); validDate2.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 8) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li3.Visible = true; UpFileText3.Controls.Add(div); validDate3.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 9) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li4.Visible = true; UpFileText4.Controls.Add(div); validDate4.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 12) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li5.Visible = true; this.HidFfileName3.Value = item.fileName; this.validDate3.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 13) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li6.Visible = true; this.HidFfileName4.Value = item.fileName; this.validDate4.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 14) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li7.Visible = true; this.HidFfileName5.Value = item.fileName; this.validDate5.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 15) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li8.Visible = true; this.HidFfileName6.Value = item.fileName; this.validDate6.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 16) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li9.Visible = true; this.HidFfileName7.Value = item.fileName; this.validDate7.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 17) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li10.Visible = true; this.HidFfileName8.Value = item.fileName; this.validDate8.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 18) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li11.Visible = true; this.HidFfileName9.Value = item.fileName; this.validDate9.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 19) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li12.Visible = true; this.HidFfileName10.Value = item.fileName; this.validDate10.Value = item.validDate.ToString("yyyy/MM/dd"); } } } } } else { this.btnUpdate.InnerHtml = "<span><img src = '../../Company/images/t02.png'/></span><font>添加</font> "; } }
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> public void bind() { List <Hi.Model.YZT_FCmaterials> fCmaterialsList = new Hi.BLL.YZT_FCmaterials().GetList("", " CompID =" + CompID + " and dr=0 ", ""); if (fCmaterialsList.Count > 0) { //修改 Hi.Model.YZT_FCmaterials fCmaterialsModel = fCmaterialsList[0]; fid = fCmaterialsModel.ID; this.txtRise.Value = fCmaterialsModel.Rise; this.txtContent.Value = fCmaterialsModel.Content; this.txtOBank.Value = fCmaterialsModel.OBank; this.txtOAccount.Value = fCmaterialsModel.OAccount; this.txtTRNumber.Value = fCmaterialsModel.TRNumber; List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + fCmaterialsModel.ID + " and dr=0 and fileAlias='4'", ""); foreach (Hi.Model.YZT_Annex item in annexList) { if (item.type == 5) { if (!string.IsNullOrWhiteSpace(item.fileName)) { //营业执照绑定 this.HidFfileName.InnerHtml = item.fileName; this.validDate.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 6) { if (!string.IsNullOrWhiteSpace(item.fileName)) { //生产许可证绑定 this.HidFfileName2.InnerHtml = item.fileName; this.validDate2.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 12) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.HidFfileName3.InnerHtml = item.fileName; this.validDate3.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 13) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.HidFfileName4.InnerHtml = item.fileName; this.validDate4.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 14) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.HidFfileName5.InnerHtml = item.fileName; this.validDate5.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 15) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.HidFfileName6.InnerHtml = item.fileName; this.validDate6.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 16) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.HidFfileName7.InnerHtml = item.fileName; this.validDate7.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 17) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.HidFfileName8.InnerHtml = item.fileName; this.validDate8.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 18) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.HidFfileName9.InnerHtml = item.fileName; this.validDate9.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 19) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.HidFfileName10.InnerHtml = item.fileName; this.validDate10.Value = item.validDate.ToString("yyyy/MM/dd"); } } } } else { fid = 0; } }
/// <summary> /// 上传合同 /// </summary> /// <param name="Name"></param> /// <param name="vDate"></param> public void insertContract(string Name, string txtForceDate, string txtInvalidDate) { string json = ""; SqlTransaction tran = null; if (!string.IsNullOrWhiteSpace(Name)) { try { tran = SqlHelper.CreateStoreTranSaction(); DateTime time = DateTime.Now; Hi.Model.YZT_Contract contractModel = new Hi.Model.YZT_Contract(); contractModel.contractNO = ""; contractModel.contractDate = time; contractModel.DisID = KeyID; contractModel.CState = 3;//线下合同 contractModel.ForceDate = Convert.ToDateTime(txtForceDate); contractModel.InvalidDate = Convert.ToDateTime(txtInvalidDate); contractModel.Remark = "线下合同"; contractModel.CreateDate = DateTime.Now; contractModel.CreateUserID = UserID; contractModel.dr = 0; contractModel.ts = DateTime.Now; contractModel.modifyuser = UserID; contractModel.CompID = CompID; int Cid = new Hi.BLL.YZT_Contract().Add(contractModel, tran); Hi.Model.YZT_Annex annexModel = new Hi.Model.YZT_Annex(); annexModel.fcID = Convert.ToInt32(Cid); annexModel.type = 10; annexModel.fileName = Name; annexModel.fileAlias = "3"; annexModel.validDate = Convert.ToDateTime(txtInvalidDate); annexModel.CreateDate = time; annexModel.dr = 0; annexModel.ts = time; annexModel.modifyuser = UserID; annexModel.CreateUserID = UserID; int count = new Hi.BLL.YZT_Annex().Add(annexModel, tran); tran.Commit(); if (count > 0) { json = "{\"ret\":\"ok\"}"; } else { json = "{\"ret\":\"上传失败\"}"; } } catch (Exception e) { tran.Rollback(); json = "{\"ret\":\"" + e.Message + "\"}"; } } else { json = "{\"ret\":\"附件不能为空!\"}"; } Response.Write(json); Response.End(); }
/// <summary> /// 修改时 需要新增的附件 /// </summary> private void updateIndestAnnex(List <Hi.Model.YZT_Annex> annexList, string id, SqlTransaction Tran) { List <Hi.Model.YZT_Annex> annex1 = annexList.Where(a => a.type == 5).ToList(); if (annex1.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName.Value.Trim())) { //新增营业执照附件表 Hi.Model.YZT_Annex annexModel = insertAnnex(Convert.ToInt32(id), 5, this.HidFfileName.Value.Trim(), this.validDate.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel, Tran); } List <Hi.Model.YZT_Annex> annex2 = annexList.Where(a => a.type == 7).ToList(); if (annex2.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName2.Value.Trim())) { //新增医疗器械经营许可证附件表 Hi.Model.YZT_Annex annexModel = insertAnnex(Convert.ToInt32(id), 7, this.HidFfileName2.Value.Trim(), this.validDate2.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel, Tran); } List <Hi.Model.YZT_Annex> annex3 = annexList.Where(a => a.type == 8).ToList(); if (annex3.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName3.Value.Trim())) { //新增营业执照附件表 Hi.Model.YZT_Annex annexModel = insertAnnex(Convert.ToInt32(id), 8, this.HidFfileName3.Value.Trim(), this.validDate3.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel, Tran); } List <Hi.Model.YZT_Annex> annex4 = annexList.Where(a => a.type == 9).ToList(); if (annex4.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName4.Value.Trim())) { //新增生产许可证表 Hi.Model.YZT_Annex annexModel4 = insertAnnex(Convert.ToInt32(id), 9, this.HidFfileName4.Value.Trim(), this.validDate4.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel4, Tran); } List <Hi.Model.YZT_Annex> annex11 = annexList.Where(a => a.type == 12).ToList(); if (annex11.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName11.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 12, this.HidFfileName11.Value.Trim(), this.validDate11.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex12 = annexList.Where(a => a.type == 13).ToList(); if (annex12.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName12.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 13, this.HidFfileName12.Value.Trim(), this.validDate12.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex5 = annexList.Where(a => a.type == 14).ToList(); if (annex5.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName5.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 14, this.HidFfileName5.Value.Trim(), this.validDate5.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex6 = annexList.Where(a => a.type == 15).ToList(); if (annex6.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName6.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 15, this.HidFfileName6.Value.Trim(), this.validDate6.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex7 = annexList.Where(a => a.type == 16).ToList(); if (annex7.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName7.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 16, this.HidFfileName7.Value.Trim(), this.validDate7.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex8 = annexList.Where(a => a.type == 17).ToList(); if (annex8.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName8.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 17, this.HidFfileName8.Value.Trim(), this.validDate8.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex9 = annexList.Where(a => a.type == 18).ToList(); if (annex9.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName9.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 18, this.HidFfileName9.Value.Trim(), this.validDate9.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } List <Hi.Model.YZT_Annex> annex10 = annexList.Where(a => a.type == 19).ToList(); if (annex10.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName10.Value.Trim())) { Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 19, this.HidFfileName10.Value.Trim(), this.validDate10.Value.Trim()); int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran); } }
/// <summary> /// 附件绑定 /// </summary> public void DataBindLink() { //查询需要提供的资料 List <Hi.Model.YZT_Annex> annexlist = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + this.KeyID + " and fileAlias in (1) and dr=0", ""); if (annexlist != null && annexlist.Count > 0) { foreach (Hi.Model.YZT_Annex item in annexlist) { if (!string.IsNullOrEmpty(item.fileName)) { LinkButton linkFile = new LinkButton(); linkFile.Click += new EventHandler(Download_Click); if (item.fileName.LastIndexOf("_") != -1) { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } else { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile.Text = text; } else { linkFile.Text = text.Substring(0, 15) + "..."; } linkFile.Attributes.Add("title", text); } linkFile.Style.Add("text-decoration", "underline"); linkFile.Attributes.Add("fileName", item.fileName); HtmlGenericControl div = new HtmlGenericControl("div"); div.Controls.Add(linkFile); if (item.fileAlias == "1" && item.type == 5) {//营业执照 this.UpFile1.Visible = true; this.validDate1.InnerText = item.validDate == DateTime.MinValue ? "" : item.validDate.ToString("yyyy-MM-dd"); UpFileText.Controls.Add(div); } else if (item.fileAlias == "1" && item.type == 7) {//医疗器械经营许可证 this.UpFile2.Visible = true; UpFileText2.Controls.Add(div); this.validDate2.InnerText = item.validDate == DateTime.MinValue ? "" : item.validDate.ToString("yyyy-MM-dd"); } else if (item.fileAlias == "1" && item.type == 9) {//开户许可证 this.UpFile3.Visible = true; UpFileText3.Controls.Add(div); this.validDate3.InnerText = item.validDate == DateTime.MinValue ? "" : item.validDate.ToString("yyyy-MM-dd"); } else if (item.fileAlias == "1" && item.type == 8) {//医疗器械备案 this.UpFile4.Visible = true; UpFileText4.Controls.Add(div); this.validDate4.InnerText = item.validDate == DateTime.MinValue ? "" : item.validDate.ToString("yyyy-MM-dd"); } } } } }
/// <summary> /// 附件绑定 /// </summary> public void DataBindLink() { //查询需要提供的资料 List <Hi.Model.YZT_Annex> annexlist = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + this.KeyID + " and fileAlias in (1) and dr=0", ""); if (annexlist != null && annexlist.Count > 0) { foreach (Hi.Model.YZT_Annex item in annexlist) { if (!string.IsNullOrEmpty(item.fileName)) { string linkFile = string.Empty; if (item.fileName.LastIndexOf("_") != -1) { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile = text; } else { linkFile = text.Substring(0, 15) + "..."; } } else { string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName); if (text.Length < 15) { linkFile = text; } else { linkFile = text.Substring(0, 15) + "..."; } } if (item.fileAlias == "1" && item.type == 5) {//营业执照 this.UpFile1.Visible = true; this.txtvalidDate1.Value = item.validDate == DateTime.MinValue ? "" : item.validDate.ToString("yyyy-MM-dd"); UpFileText1.InnerHtml = "<dl class=\"teamList\"><dd><a style=\"cursor: pointer;\" class=\"bt\" href=\"../../UploadFile/" + item.fileName + "\" download=" + item.fileName + " target=\"_blank\">" + linkFile + "</a><a class=\"red\" onclick=\"Cancel(1)\">删除</a></dd></dl>"; this.HidFfileName1.Value = item.fileName; } else if (item.fileAlias == "1" && item.type == 7) {//医疗器械经营许可证 this.UpFile2.Visible = true; UpFileText2.InnerHtml = "<dl class=\"teamList\"><dd><a style=\"cursor: pointer;\" class=\"bt\" href=\"../../UploadFile/" + item.fileName + "\" download=" + item.fileName + " target=\"_blank\">" + linkFile + "</a><a class=\"red\" onclick=\"Cancel(2)\">删除</a></dd></dl>"; this.txtvalidDate2.Value = item.validDate == DateTime.MinValue ? "" : item.validDate.ToString("yyyy-MM-dd"); this.HidFfileName2.Value = item.fileName; } else if (item.fileAlias == "1" && item.type == 9) {//开户许可证 this.UpFile3.Visible = true; UpFileText3.InnerHtml = "<dl class=\"teamList\"><dd><a style=\"cursor: pointer;\" class=\"bt\" href=\"../../UploadFile/" + item.fileName + "\" download=" + item.fileName + " target=\"_blank\">" + linkFile + "</a><a class=\"red\" onclick=\"Cancel(3)\">删除</a></dd></dl>"; this.txtvalidDate3.Value = item.validDate == DateTime.MinValue ? "" : item.validDate.ToString("yyyy-MM-dd"); this.HidFfileName3.Value = item.fileName; } else if (item.fileAlias == "1" && item.type == 8) {//医疗器械备案 this.UpFile4.Visible = true; UpFileText4.InnerHtml = "<dl class=\"teamList\"><dd><a style=\"cursor: pointer;\" class=\"bt\" href=\"../../UploadFile/" + item.fileName + "\" download=" + item.fileName + " target=\"_blank\">" + linkFile + "</a><a class=\"red\" onclick=\"Cancel(4)\">删除</a></dd></dl>"; this.txtvalidDate4.Value = item.validDate == DateTime.MinValue ? "" : item.validDate.ToString("yyyy-MM-dd"); this.HidFfileName4.Value = item.fileName; } } } } }
/// <summary> /// 页面数据绑定 /// </summary> public void bind() { this.li1.Visible = false; this.li2.Visible = false; this.li3.Visible = false; this.li4.Visible = false; this.li5.Visible = false; this.li6.Visible = false; this.li7.Visible = false; this.li8.Visible = false; this.li9.Visible = false; this.li10.Visible = false; string fid = Request.QueryString["fid"]; if (!string.IsNullOrWhiteSpace(fid)) { string CompID = Request.QueryString["CompID"]; Hi.Model.YZT_FCmaterials fCmaterialsModel = new Hi.BLL.YZT_FCmaterials().GetModel(Convert.ToInt32(fid)); if (fCmaterialsModel != null) { DataTable table = new Hi.BLL.YZT_FCmaterials().getDataModel(fCmaterialsModel.DisID.ToString(), "and f.ID=" + fid + " and d.ID=" + CompID); if (table != null && table.Rows.Count > 0) { this.txtComCode.Value = table.Rows[0]["CompCode"].ToString(); this.txtComName.Value = table.Rows[0]["CompName"].ToString(); dataBindGoods(table.Rows[0]["CompID"].ToString()); } this.txtRise.Value = fCmaterialsModel.Rise; this.txtContent.Value = fCmaterialsModel.Content; this.txtOBank.Value = fCmaterialsModel.OBank; this.txtOAccount.Value = fCmaterialsModel.OAccount; this.txtTRNumber.Value = fCmaterialsModel.TRNumber; List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + fCmaterialsModel.ID + " and dr=0 and fileAlias='4'", ""); foreach (Hi.Model.YZT_Annex item in annexList) { if (item.type == 5) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li1.Visible = true; //营业执照绑定 this.HidFfileName.Value = item.fileName; this.validDate.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 6) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li2.Visible = true; //生产许可证绑定 this.HidFfileName2.Value = item.fileName; this.validDate2.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 12) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li3.Visible = true; this.HidFfileName3.Value = item.fileName; this.validDate3.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 13) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li4.Visible = true; this.HidFfileName4.Value = item.fileName; this.validDate4.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 14) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li5.Visible = true; this.HidFfileName5.Value = item.fileName; this.validDate5.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 15) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li6.Visible = true; this.HidFfileName6.Value = item.fileName; this.validDate6.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 16) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li7.Visible = true; this.HidFfileName7.Value = item.fileName; this.validDate7.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 17) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li8.Visible = true; this.HidFfileName8.Value = item.fileName; this.validDate8.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 18) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li9.Visible = true; this.HidFfileName9.Value = item.fileName; this.validDate9.Value = item.validDate.ToString("yyyy/MM/dd"); } } else if (item.type == 19) { if (!string.IsNullOrWhiteSpace(item.fileName)) { this.li10.Visible = true; this.HidFfileName10.Value = item.fileName; this.validDate10.Value = item.validDate.ToString("yyyy/MM/dd"); } } } } } }