public void BindTarget(int policyID) { IList <To_PolicyTarget> targetList = To_PolicyTargetManager.GetListByPolicy(policyID); if (targetList.Count > 0) { rpTargetProperty.DataSource = targetList; rpTargetProperty.DataBind(); TargetTypeManager tpBLL = new TargetTypeManager(); TargetType tpModel = tpBLL.GetModel(targetList[0].PropertyTypeID); if (tpModel != null) { ltrTargetType.Text = tpModel.TypeName; } } }
/// <summary> /// 添加保单的方法 /// </summary> /// <param name="policy"></param> private void Add(To_Policy policy) { int policyId = To_PolicyManager.addTo_Policy(policy); //具体保险项目 if (policyId > 0 && HidPros.Value != "") { //string[] items = HidPros.Value.TrimEnd('|').Split('|'); //To_PolicyDetail pdModel = new To_PolicyDetail(); //foreach (string item in items) //{ // string[] proInfo = item.Split('$'); // pdModel.Coverage = double.Parse(proInfo[1]);//保额 // pdModel.Premium = double.Parse(proInfo[2]);//保费 // pdModel.PolicyId = policyId;//保单ID // pdModel.ProductId = int.Parse(proInfo[0].Trim());//保险项目 // pdModel.Mark = proInfo[3];//备注 // To_PolicyDetailManager.addTo_PolicyDetail(pdModel); //} string[] list = HidPros.Value.Split(','); //以逗号分隔每一行的数据 string[] txt = null; //存储每一行每一个单元的数据 List <string> p = new List <string>(); //存储业务员汇总 To_PolicyDetail model = null; for (int i = 0; i < list.Length; i++) { model = new To_PolicyDetail(); txt = list[i].Split('|'); model.PolicyId = policyId; //保单id model.Salesman = txt[0]; //业务员 if (!p.Contains(txt[0])) { p.Add(txt[0]); } model.DepartName = txt[1]; //部门 model.NumRate = decimal.Parse(txt[2]); //比率 model.Fmone = decimal.Parse(txt[3]); //经济费 model.Rich = decimal.Parse(txt[4]); //贴费 model.Mark = txt[5]; //备注 To_PolicyDetailManager.addTo_PolicyDetail(model); } StringBuilder persons = new StringBuilder(); foreach (string s in p) { persons.Append(s + ";"); } To_PolicyManager.updateTo_PolicySalesman(persons.ToString(), policyId); //标的信息 if (HidTarget.Value != "") { string hidValues = HidTarget.Value.TrimEnd('@').Replace("\r\n", ""); string[] values = hidValues.Split('@'); To_PolicyTarget To_PolicyTarget = new To_PolicyTarget(); To_PolicyTarget.PolicyID = policyId; foreach (string value in values) { string[] propertyArr = value.Split('$'); To_PolicyTarget.Datatype = propertyArr[4].Trim() == "" ? 0 : int.Parse(propertyArr[4].Trim()); To_PolicyTarget.PropertyName = propertyArr[0].Trim(); To_PolicyTarget.PropertyTypeID = propertyArr[2].Trim() == "" ? 0 : int.Parse(propertyArr[2].Trim()); To_PolicyTarget.PropertyValue = propertyArr[1].Trim(); To_PolicyTarget.PropertyID = propertyArr[3].Trim() == "" ? 0 : int.Parse(propertyArr[3].Trim()); To_PolicyTargetManager.addTo_PolicyTarget(To_PolicyTarget); } } //上传附件并返回文件名集合 string[] str = FileUp(Request.Files); if (str[0] == "" && str[6] == "1") { SaveFilePath(str, policyId); } } _policyID = policyId; }
/// <summary> /// 保存保单(编辑或添加) /// </summary> /// <returns>返回业务编号</returns> private string SavePolicy(int jobflowid) { To_Policy policyModel = new To_Policy(); string cuscode = ""; //公司代码全称 string codeformat = ""; //公司代码,不包含流水号 string ordernum = ""; //流水号 if (StrNumbers(TxtSerialNum.Text.Trim(), out cuscode, out codeformat, out ordernum)) { policyModel.Assured = TxtAssured.Text; //被保险人 policyModel.Company = int.Parse(HidComId.Value); //保险公司 policyModel.Customer = int.Parse(HidCusId.Value); //投保客户 policyModel.IsVerify = jobflowid; //工作流管理id policyModel.Policy_date = Convert.ToDateTime(TxtPolicyDate.Text); //表单日期 policyModel.Policy_enddate = Convert.ToDateTime(txtEndTime.Text).ToString("yyyy-MM-dd"); //Convert.ToDateTime(TxtTimeStart.Text).AddYears(int.Parse(TxtYears.Text.Trim())).ToString("yyyy-MM-dd");//投保到期日期 policyModel.Policy_startdate = Convert.ToDateTime(TxtTimeStart.Text).ToString("yyyy-MM-dd"); //投保开始日期 policyModel.Policy_maker = TxtPolicyMaker.Text; //制单人 policyModel.Policy_num = TxtPolicyNum.Text; //表单编号 policyModel.Policy_state = Convert.ToInt32(DdlPolicyState.SelectedValue); //保单状态(0:无效;1:有效) policyModel.Protype = HidTypeId.Value; //险种 //policyModel.Salesman = int.Parse(HidSalesman.Value);// int.Parse(TxtSalesman.Text);//所属业务员 policyModel.Salesman = 0; //去掉主表中的业务员信息,将其设置为默认0; //policyModel.Serialnum = TxtSerialNum.Text;//内部流水号 policyModel.Verifydate = DateTime.Now; // Convert.ToDateTime(TxtVerifyDate.Text);//审核日期 policyModel.VerifyUser = ""; // TxtVerifyUser.Text;//审核人 policyModel.IsRenewal = Convert.ToInt32(DdlIsRenewal.SelectedValue); //是否续保 policyModel.UserCompany = ddlUnit.SelectedItem.Text; //经营单位 policyModel.TotalEcoRate = Convert.ToDouble(zjjfrate.Text); //总经济费比率 policyModel.TotalEconomic = Convert.ToDouble(this.zjjf.Text); //总经济费 policyModel.TotalRich = Convert.ToDouble(ztf.Text); //总贴费 policyModel.ShipName = cm.Text; //船名 policyModel.TotalPremium = Convert.ToDouble(zbf.Text); //总保费 policyModel.TotalBrokerage = Convert.ToDouble(zbe.Text); //总保额 policyModel.Txt = ""; //审核意见 policyModel.IsDaidian = int.Parse(DdlIsDaidian.SelectedValue.Trim()); //是否代垫保费,0:否,1:是 policyModel.OrderNum = ordernum; policyModel.CodeFormart = codeformat; policyModel.Serialnum = cuscode; object action = Request.QueryString["action"]; //表示编辑保单 if (action != null && action.ToString() == "edit") { List <string> p = new List <string>(); //存储业务员的汇总 object id = Request.QueryString["id"]; int rid = 0; if (id != null && int.TryParse(id.ToString(), out rid)) { policyModel.Id = rid; if (To_PolicyManager.updateTo_Policy(policyModel) > 0) { To_PolicyDetailManager.DeleteByPolicy(policyModel.Id); if (HidPros.Value != "") { string[] items = HidPros.Value.Split(','); string[] txt = null; To_PolicyDetail pdModel = null; foreach (string item in items) { pdModel = new To_PolicyDetail(); txt = item.Split('|'); pdModel.PolicyId = policyModel.Id; //保单id pdModel.Salesman = txt[0]; //业务员 if (!p.Contains(txt[0])) { p.Add(txt[0]); } pdModel.DepartName = txt[1]; //部门 pdModel.NumRate = decimal.Parse(txt[2]); //比率 pdModel.Fmone = decimal.Parse(txt[3]); //经济费 pdModel.Rich = decimal.Parse(txt[4]); //贴费 pdModel.Mark = txt[5]; //备注 To_PolicyDetailManager.addTo_PolicyDetail(pdModel); } StringBuilder persons = new StringBuilder(); foreach (string s in p) { persons.Append(s + ";"); } To_PolicyManager.updateTo_PolicySalesman(persons.ToString(), rid); } To_PolicyTargetManager.DeleteByPolicy(rid); if (HidTarget.Value != "") { string hidValues = HidTarget.Value.TrimEnd('@').Replace("\r\n", ""); string[] values = hidValues.Split('@'); To_PolicyTarget To_PolicyTarget = new To_PolicyTarget(); To_PolicyTarget.PolicyID = rid; foreach (string value in values) { string[] propertyArr = value.Split('$'); To_PolicyTarget.Datatype = propertyArr[4].Trim() == "" ? 0 : int.Parse(propertyArr[4].Trim()); To_PolicyTarget.PropertyName = propertyArr[0].Trim(); To_PolicyTarget.PropertyTypeID = propertyArr[2].Trim() == "" ? 0 : int.Parse(propertyArr[2].Trim()); To_PolicyTarget.PropertyValue = propertyArr[1].Trim(); To_PolicyTarget.PropertyID = propertyArr[3].Trim() == "" ? 0 : int.Parse(propertyArr[3].Trim()); To_PolicyTargetManager.addTo_PolicyTarget(To_PolicyTarget); } } if (HidFiles.Value != "") { string oldFiles = HidFiles.Value.Trim().TrimEnd(','); if (oldFiles != "") { To_PolicyFileManager policyFileBLL = new To_PolicyFileManager(); policyFileBLL.DeleteList(oldFiles); } } //上传附件并返回文件名集合 string[] str = FileUp(Request.Files); if (str[0] == "" && str[6] == "1") { SaveFilePath(str, rid); } } UCBudgetEdit1.SaveData(rid); } } //新增保单 else if (action != null && action.ToString() == "new") { policyModel.Policy_makerId = (Session["login"] as LoginInfo).Id; Add(policyModel); } } return(cuscode); }