private void CardType_Load(object sender, EventArgs e) { string strsql = "select * from tbNameCode where cnvcType='" + ConstApp.CardType + "'"; DataTable dt = Helper.Query(strsql); if (dt.Rows.Count > 0) { NameCode nc = new NameCode(dt); switch (nc.cnvcValue) { case "l6": this.l6.Checked = true; this.l8.Checked = false; break; case "l8": this.l6.Checked = false; this.l8.Checked = true; break; case "l6l8": this.l6.Checked = true; this.l8.Checked = true; break; } //this.ultraOptionSet1.Value = nc.cnvcValue; } MemberManageFacade mf = new MemberManageFacade(); this.txtL6.Text = mf.GetCardTypeName(ConstApp.CardType_L6); this.txtL8.Text = mf.GetCardTypeName(ConstApp.CardType_L8); }
/// <summary> /// 绑定会员参数类型 /// </summary> /// <param name="cmbMemberCode"></param> public static void BindMemberCode(UltraComboEditor cmbMemberCode, string strMember) { ArrayList alMemberCode = new ArrayList(); if (strMember == ConstApp.MemberType) { alMemberCode.Add(ConstApp.FreeType); alMemberCode.Add(ConstApp.BookDate); alMemberCode.Add(ConstApp.DisabledDate); alMemberCode.Add(ConstApp.DisabledDateMinAmount); alMemberCode.Add(ConstApp.MemberDiscount); alMemberCode.Add(ConstApp.MemberSeats); alMemberCode.Add(ConstApp.MemberFee); alMemberCode.Add(ConstApp.BookTimes); alMemberCode.Add(ConstApp.PointsBK); alMemberCode.Add(ConstApp.PointsCZ); alMemberCode.Add(ConstApp.PointsXF); alMemberCode.Add(ConstApp.PointsJF); alMemberCode.Add(ConstApp.IsJob); alMemberCode.Add(ConstApp.IsMemberFee); alMemberCode.Add(ConstApp.IsInMoney); alMemberCode.Add(ConstApp.IsProduct); alMemberCode.Add(ConstApp.IsProductSelect); alMemberCode.Add(ConstApp.IsFeeType); alMemberCode.Add(ConstApp.IsDisabledDate); DataTable dtProduct = Query("select * from tbNameCode where cnvcType = '" + ConstApp.Product + "' order by cnvcValue"); foreach (DataRow drProduct in dtProduct.Rows) { NameCode namceCode = new NameCode(drProduct); if (!alMemberCode.Contains(namceCode.cnvcValue)) { alMemberCode.Add(namceCode.cnvcValue); } } //DataTable dtProduct = Query("select * from tbNameCode where cnvcType = '" + ConstApp.ValueAddedServices + "' order by cnvcValue"); //foreach (DataRow drProduct in dtProduct.Rows) //{ // NameCode namceCode = new NameCode(drProduct); // if (!alMemberCode.Contains(namceCode.cnvcValue)) // { // alMemberCode.Add(namceCode.cnvcValue); // } //} } if (strMember == ConstApp.Product) { alMemberCode.Add(ConstApp.ProductPrice); alMemberCode.Add(ConstApp.ProductDiscount); alMemberCode.Add(ConstApp.ProductPoints); } cmbMemberCode.SetDataBinding(alMemberCode, null); }
public override string ToString() { var s1 = NameCode.ToString() + " " + this.NameText; if (this.ValueText != null) { s1 += " " + this.ValueText; } return(s1); }
private void btnDelete_Click(object sender, System.EventArgs e) { try { DialogResult strRet = MessageBox.Show(this, "是否删除?", "会员参数设置", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (strRet == DialogResult.Yes) { UltraGridRow row = this.ultraGrid1.ActiveRow; if (null == row) { throw new BusinessException("参数设置", "请选择参数"); } if (cmbType.SelectedItem == null) { throw new BusinessException("参数设置", "请选择参数类型"); } if (txtValue.Text.Trim().Length == 0) { throw new BusinessException("参数设置", "请输入参数值"); } string strType = row.Cells["cnvcType"].Value.ToString(); DataTable dtNameCode = Helper.Query("select * from tbNameCode where cnvcType='" + strType + "'"); if (dtNameCode.Rows.Count < 2) { throw new BusinessException("会员参数设置", "【参数类型】+【参数值】必须要有"); } NameCode nameCode = new NameCode(); nameCode.cnvcCodeID = int.Parse(row.Cells["cnvcCodeID"].Value.ToString()); MemberManageFacade memberManage = new MemberManageFacade(); memberManage.DeleteNameCode(nameCode); MessageBox.Show(this, "参数删除成功!", "参数设置", MessageBoxButtons.OK, MessageBoxIcon.Information); BindNamecode(); BindMemberRight(); cmbMember_ValueChanged(null, null); //Helper.BindMemberCode(cmbMemberType); ynhrMemberManage.BusinessFacade.SysInit.LoadPara(Login.constApp); } } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static void AddNewDeptType(NameCode newnc, Oper oper) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { DateTime dtSysTime = Helper.GetSysTime(trans); EntityMapping.Create(newnc, trans); BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = dtSysTime; busiLog.cnnBusiSerialNo = Helper.GetSerialNo(trans); busiLog.cnvcComments = "添加新部门属性"; busiLog.cnvcFuncCode = " 客户档案管理"; busiLog.cnvcOperID = oper.cnvcOperID; busiLog.cnvcIPAddress = ""; EntityMapping.Create(busiLog, trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); throw sex; } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
public static void LoadPara(ConstApp ca) { ca.dtNameCode = SqlHelper.ExecuteDataTable(CommandType.Text, "select * from tbNameCode"); ca.dtMemberCode = SqlHelper.ExecuteDataTable(CommandType.Text, "select * from tbMemberCode"); ca.alMemberType.Clear(); ca.alEnterpriseType.Clear(); ca.alProduct.Clear(); ca.alTrade.Clear(); ca.alInMoneyDiscount.Clear(); DataRow[] drMemberTypes = ca.dtNameCode.Select("cnvcType='" + ConstApp.MemberType + "'"); foreach (DataRow drMemberType in drMemberTypes) { NameCode nameCode = new NameCode(drMemberType); ca.alMemberType.Add(nameCode.cnvcValue); } DataRow[] drEnterpriseTypes = ca.dtNameCode.Select("cnvcType='" + ConstApp.EnterpriseType + "'"); foreach (DataRow drEnterpriseType in drEnterpriseTypes) { NameCode nameCode = new NameCode(drEnterpriseType); ca.alEnterpriseType.Add(nameCode.cnvcValue); } DataRow[] drProducts = ca.dtNameCode.Select("cnvcType='" + ConstApp.Product + "'"); foreach (DataRow drProduct in drProducts) { NameCode nameCode = new NameCode(drProduct); ca.alProduct.Add(nameCode.cnvcValue); } DataRow[] drTrades = ca.dtNameCode.Select("cnvcType='" + ConstApp.Trade + "'"); foreach (DataRow drTrade in drTrades) { NameCode nameCode = new NameCode(drTrade); ca.alTrade.Add(nameCode.cnvcValue); } //ЁДж╣уш©ш DataRow[] drInMoneyDiscounts = ca.dtNameCode.Select("cnvcType='" + ConstApp.InMoneyDiscount + "'"); foreach (DataRow drInMoneyDiscount in drInMoneyDiscounts) { NameCode nameCode = new NameCode(drInMoneyDiscount); ca.alInMoneyDiscount.Add(nameCode.cnvcValue); } DataRow[] drJobBookDates = ca.dtNameCode.Select("cnvcType='" + ConstApp.BookDate + "'"); if (drJobBookDates.Length > 0) { NameCode nameCode = new NameCode(drJobBookDates[0]); ca.iBookDate = int.Parse(nameCode.cnvcValue); } DataRow[] drTishis = ca.dtNameCode.Select("cnvcType='" + ConstApp.tishi + "'"); if (drTishis.Length > 0) { NameCode nameCode = new NameCode(drTishis[0]); ca.iTishi = int.Parse(nameCode.cnvcValue); } DataRow[] drTouchFlash = ca.dtNameCode.Select("cnvcType='" + ConstApp.TouchFlash + "'"); if (drTouchFlash.Length > 0) { NameCode nameCode = new NameCode(drTouchFlash[0]); ca.iTouchFlash = int.Parse(nameCode.cnvcValue); } DataRow[] drTouchBookBeginDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.TouchBookBeginDate + "'"); if (drTouchBookBeginDate.Length > 0) { NameCode nameCode = new NameCode(drTouchBookBeginDate[0]); ca.dTouchBookBeginDate = nameCode.cnvcValue; } DataRow[] drTouchBookEndDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.TouchBookEndDate + "'"); if (drTouchBookEndDate.Length > 0) { NameCode nameCode = new NameCode(drTouchBookEndDate[0]); ca.dTouchBookEndDate = nameCode.cnvcValue; } DataRow[] drTouchSignInBeginDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.TouchSignInBeginDate + "'"); if (drTouchSignInBeginDate.Length > 0) { NameCode nameCode = new NameCode(drTouchSignInBeginDate[0]); ca.dTouchSignInBeginDate = nameCode.cnvcValue; } DataRow[] drTouchSignInEndDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.TouchSignInEndDate + "'"); if (drTouchSignInEndDate.Length > 0) { NameCode nameCode = new NameCode(drTouchSignInEndDate[0]); ca.dTouchSignInEndDate = nameCode.cnvcValue; } DataRow[] drJobBeginDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.JobListBeginDate + "'"); if (drJobBeginDate.Length > 0) { NameCode nameCode = new NameCode(drJobBeginDate[0]); ca.strJobBeginDate = nameCode.cnvcValue; } DataRow[] drJobEndDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.JobListEndDate + "'"); if (drJobEndDate.Length > 0) { NameCode nameCode = new NameCode(drJobEndDate[0]); ca.strJobEndDate = nameCode.cnvcValue; } DataRow[] drJobBookingBeginDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.JobBookingListBeginDate + "'"); if (drJobBookingBeginDate.Length > 0) { NameCode nameCode = new NameCode(drJobBookingBeginDate[0]); ca.strJobBookingBeginDate = nameCode.cnvcValue; } DataRow[] drJobBookingEndDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.JobBookingListEndDate + "'"); if (drJobBookingEndDate.Length > 0) { NameCode nameCode = new NameCode(drJobBookingEndDate[0]); ca.strJobBookingEndDate = nameCode.cnvcValue; } DataRow[] drJobRemainBeginDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.JobRemainListBeginDate + "'"); if (drJobRemainBeginDate.Length > 0) { NameCode nameCode = new NameCode(drJobRemainBeginDate[0]); ca.strJobRemainBeginDate = nameCode.cnvcValue; } DataRow[] drJobRemainEndDate = ca.dtNameCode.Select("cnvcType='" + ConstApp.JobRemainListEndDate + "'"); if (drJobRemainEndDate.Length > 0) { NameCode nameCode = new NameCode(drJobRemainEndDate[0]); ca.strJobRemainEndDate = nameCode.cnvcValue; } DataRow[] drInMoneySetting = ca.dtNameCode.Select("cnvcType='" + ConstApp.InMoneySetting + "'"); if (drInMoneySetting.Length > 0) { NameCode nameCode = new NameCode(drInMoneySetting[0]); ca.bInMoneyDonate = nameCode.cnvcValue == "1"?true:false; } DataRow[] drCardTypes = ca.dtNameCode.Select("cnvcType='" + ConstApp.CardType + "'"); if (drCardTypes.Length > 0) { NameCode nameCode = new NameCode(drCardTypes[0]); ca.strCardType = nameCode.cnvcValue; } //zhh 20140611 DataRow[] drCardTypeL6s = ca.dtNameCode.Select("cnvcType='" + ConstApp.CardType_L6 + "'"); if (drCardTypeL6s.Length > 0) { NameCode nameCode = new NameCode(drCardTypeL6s[0]); ca.strCardTypeL6Name = nameCode.cnvcValue; } DataRow[] drCardTypeL8s = ca.dtNameCode.Select("cnvcType='" + ConstApp.CardType_L8 + "'"); if (drCardTypeL8s.Length > 0) { NameCode nameCode = new NameCode(drCardTypeL8s[0]); ca.strCardTypeL8Name = nameCode.cnvcValue; } ca.htFree.Clear(); ca.htBookDate.Clear(); ca.htDisabledDate.Clear(); ca.htDisabledDateMinAmount.Clear(); ca.htMemberDiscount.Clear(); ca.htMemberSeats.Clear(); ca.htDept.Clear(); ca.htMemberFee.Clear(); DataRow[] drFreeTypes = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.FreeType + "'"); foreach (DataRow drFreeType in drFreeTypes) { MemberCode memberCode = new MemberCode(drFreeType); ca.htFree.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataRow[] drBookDates = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.BookDate + "'"); foreach (DataRow drBookDate in drBookDates) { MemberCode memberCode = new MemberCode(drBookDate); ca.htBookDate.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataRow[] drDisabledDates = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.DisabledDate + "'"); foreach (DataRow drDisabledDate in drDisabledDates) { MemberCode memberCode = new MemberCode(drDisabledDate); ca.htDisabledDate.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } //zhh 20130315 DataRow[] drDisabledDateMinAmounts = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.DisabledDateMinAmount + "'"); foreach (DataRow drDisabledDateMinAmount in drDisabledDateMinAmounts) { MemberCode memberCode = new MemberCode(drDisabledDateMinAmount); ca.htDisabledDateMinAmount.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } //end zhh 20130315 DataRow[] drMemberDiscounts = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.MemberDiscount + "'"); foreach (DataRow drMemberDiscount in drMemberDiscounts) { MemberCode memberCode = new MemberCode(drMemberDiscount); ca.htMemberDiscount.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataRow[] drMemberSeats = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.MemberSeats + "'"); foreach (DataRow drMemberSeat in drMemberSeats) { MemberCode memberCode = new MemberCode(drMemberSeat); ca.htMemberSeats.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataRow[] drMemberFees = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.MemberFee + "'"); foreach (DataRow drMemberFee in drMemberFees) { MemberCode memberCode = new MemberCode(drMemberFee); ca.htMemberFee.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataTable dtDept = SqlHelper.ExecuteDataTable(CommandType.Text, "select * from tbDept"); foreach (DataRow drDept in dtDept.Rows) { Dept dept = new Dept(drDept); ca.htDept.Add(dept.cnnDeptID, dept); } //zhh 2014-06-06 ca.htIsJob.Clear(); DataRow[] drIsJobs = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.IsJob + "'"); foreach (DataRow drIsJob in drIsJobs) { MemberCode memberCode = new MemberCode(drIsJob); ca.htIsJob.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } ca.htIsMemberFee.Clear(); DataRow[] drIsMemberFees = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.IsMemberFee + "'"); foreach (DataRow drIsMemberFee in drIsMemberFees) { MemberCode memberCode = new MemberCode(drIsMemberFee); ca.htIsMemberFee.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } ca.htIsInMoney.Clear(); DataRow[] drIsInMoneys = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.IsInMoney + "'"); foreach (DataRow drIsInMoney in drIsInMoneys) { MemberCode memberCode = new MemberCode(drIsInMoney); ca.htIsInMoney.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } ca.htIsProduct.Clear(); DataRow[] drIsProducts = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.IsProduct + "'"); foreach (DataRow drIsProduct in drIsProducts) { MemberCode memberCode = new MemberCode(drIsProduct); ca.htIsProduct.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } ca.htIsProductSelect.Clear(); DataRow[] drIsProductSelects = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.IsProductSelect + "'"); foreach (DataRow drIsProductSelect in drIsProductSelects) { MemberCode memberCode = new MemberCode(drIsProductSelect); ca.htIsProductSelect.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } ca.htIsFeeType.Clear(); DataRow[] drIsFeeTypes = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.IsFeeType + "'"); foreach (DataRow drIsFeeType in drIsFeeTypes) { MemberCode memberCode = new MemberCode(drIsFeeType); ca.htIsFeeType.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } ca.htIsDisabledDate.Clear(); DataRow[] drIsDisabledDates = ca.dtMemberCode.Select("cnvcMemberType='" + ConstApp.IsDisabledDate + "'"); foreach (DataRow drIsDisabledDate in drIsDisabledDates) { MemberCode memberCode = new MemberCode(drIsDisabledDate); ca.htIsDisabledDate.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } }
private void btnModify_Click(object sender, System.EventArgs e) { try { UltraGridRow row = this.ultraGrid1.ActiveRow; if (null == row) { throw new BusinessException("参数设置", "请选择参数"); } if (cmbType.SelectedItem == null) { throw new BusinessException("参数设置", "请选择参数类型"); } if (txtValue.Text.Trim().Length == 0) { throw new BusinessException("参数设置", "请输入参数值"); } string strType = row.Cells["cnvcType"].Value.ToString(); string strValue = row.Cells["cnvcValue"].Value.ToString(); if (strType != cmbType.Text) { throw new BusinessException("参数设置", "参数类型不能修改"); } if (strValue == txtValue.Text) { throw new BusinessException("参数设置", "请修改参数值"); } DataTable dtNameCode = Helper.Query("select * from tbNameCode where cnvcType='" + cmbType.Text + "' and cnvcValue='" + txtValue.Text + "'"); if (dtNameCode.Rows.Count > 0) { throw new BusinessException("参数设置", "【参数类型】+【参数值】已存在"); } if (cmbType.Text == ConstApp.TouchFlash) { //JudgeOne(cmbType.Text); int.Parse(txtValue.Text); } if (cmbType.Text == ConstApp.TouchBookBeginDate || cmbType.Text == ConstApp.TouchBookEndDate || cmbType.Text == ConstApp.TouchSignInBeginDate || cmbType.Text == ConstApp.TouchSignInEndDate ) { //JudgeOne(cmbType.Text); if (txtValue.Text.IndexOf(":") < 0) { throw new BusinessException("会员参数设置", "请输入时间格式,例如05:01"); } //string strValue = txtValue.Text; string[] strValues = txtValue.Text.Split(':'); // string strHour = strValues[0]; // string strMinute = strValues[1]; int.Parse(strValues[0]); int.Parse(strValues[1]); } if (cmbType.Text == ConstApp.BookDate) { int.Parse(txtValue.Text); } if (cmbType.Text == ConstApp.tishi) { int.Parse(txtValue.Text); } NameCode nameCode = new NameCode(dtNameCode); nameCode.cnvcCodeID = int.Parse(row.Cells["cnvcCodeID"].Value.ToString()); nameCode.cnvcType = cmbType.Text; nameCode.cnvcValue = txtValue.Text; MemberManageFacade memberManage = new MemberManageFacade(); memberManage.ModifyNameCode(nameCode); MessageBox.Show(this, "参数修改成功!", "会员参数设置", MessageBoxButtons.OK, MessageBoxIcon.Information); BindNamecode(); BindMemberRight(); cmbMember_ValueChanged(null, null); ynhrMemberManage.BusinessFacade.SysInit.LoadPara(Login.constApp); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message + "\n参数异常,请核查", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAdd_Click(object sender, System.EventArgs e) { try { if (cmbType.SelectedItem == null) { throw new BusinessException("会员参数设置", "请选择参数类型"); } if (txtValue.Text.Trim().Length == 0) { throw new BusinessException("会员参数设置", "请输入参数值"); } DataTable dtNameCode = Helper.Query("select * from tbNameCode where cnvcType='" + cmbType.Text + "' and cnvcValue='" + txtValue.Text + "'"); if (dtNameCode.Rows.Count > 0) { throw new BusinessException("会员参数设置", "【参数类型】+【参数值】已存在"); } if (cmbType.Text == ConstApp.TouchFlash) { JudgeOne(cmbType.Text); int.Parse(txtValue.Text); } if (cmbType.Text == ConstApp.TouchBookBeginDate || cmbType.Text == ConstApp.TouchBookEndDate || cmbType.Text == ConstApp.TouchSignInBeginDate || cmbType.Text == ConstApp.TouchSignInEndDate ) { JudgeOne(cmbType.Text); if (txtValue.Text.IndexOf(":") < 0) { throw new BusinessException("会员参数设置", "请输入时间格式,例如05:01"); } string strValue = txtValue.Text; string[] strValues = strValue.Split(':'); string strHour = strValues[0]; string strMinute = strValues[1]; int.Parse(strHour); int.Parse(strMinute); } if (cmbType.Text == ConstApp.BookDate) { JudgeOne(cmbType.Text); int.Parse(txtValue.Text); } if (cmbType.Text == ConstApp.NetBookBeforeDate) { JudgeOne(cmbType.Text); int.Parse(txtValue.Text); } if (cmbType.Text == ConstApp.tishi) { JudgeOne(cmbType.Text); int.Parse(txtValue.Text); } if (cmbType.Text == ConstApp.JobListBeginDate || cmbType.Text == ConstApp.JobBookingListBeginDate || cmbType.Text == ConstApp.JobBookingListEndDate || cmbType.Text == ConstApp.JobRemainListBeginDate || cmbType.Text == ConstApp.JobRemainListEndDate) { JudgeOne(cmbType.Text); DateTime.Parse(txtValue.Text); } if (cmbType.Text == ConstApp.JobListEndDate) { JudgeOne(cmbType.Text); DateTime.Parse(txtValue.Text); } NameCode nameCode = new NameCode(); nameCode.cnvcType = cmbType.Text; nameCode.cnvcValue = txtValue.Text; if (cmbType.Text == ConstApp.JobListBeginDate || cmbType.Text == ConstApp.JobListEndDate || cmbType.Text == ConstApp.JobBookingListBeginDate || cmbType.Text == ConstApp.JobBookingListEndDate || cmbType.Text == ConstApp.JobRemainListBeginDate || cmbType.Text == ConstApp.JobRemainListEndDate) { nameCode.cnvcValue = Convert.ToDateTime(txtValue.Text).ToString("yyyy-MM-dd"); } MemberManageFacade memberManage = new MemberManageFacade(); memberManage.AddNameCode(nameCode); MessageBox.Show(this, "参数添加成功!", "会员参数设置", MessageBoxButtons.OK, MessageBoxIcon.Information); BindNamecode(); BindMemberRight(); cmbMember_ValueChanged(null, null); ynhrMemberManage.BusinessFacade.SysInit.LoadPara(Login.constApp); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private DataSet CheckChance(DataSet ds) { int iError = 0; DataTable dtDept = Application[ConstApp.A_DEPT] as DataTable; Hashtable htDept = new Hashtable(); foreach (DataRow dr in dtDept.Rows) { Dept tDept = new Dept(dr); htDept.Add(tDept.cnvcDeptName, tDept.cnvcDeptID); } DataTable dtCust = Helper.Query("select cnnCustID,cnvcName from tbCust"); Hashtable htCust = new Hashtable(); foreach (DataRow dr in dtCust.Rows) { Cust tCust = new Cust(dr); htCust.Add(tCust.cnvcName, tCust.cnnCustID); } DataTable dtOper = Application[ConstApp.A_OPER] as DataTable; DataRow[] drMgr = dtOper.Select("cnvcRoleCode='customer'"); Hashtable htMgr = new Hashtable(); foreach (DataRow dr in drMgr) { Oper tOper = new Oper(dr); htMgr.Add(tOper.cnvcOperName, tOper.cnvcOperID); } DataRow[] drTradeMgr = dtOper.Select("cnvcRoleCode='trade'"); Hashtable htTradeMgr = new Hashtable(); foreach (DataRow dr in drTradeMgr) { Oper tOper = new Oper(dr); htTradeMgr.Add(tOper.cnvcOperName, tOper.cnvcOperID); } DataTable dtNameCode = Application[ConstApp.A_NAMECODE] as DataTable; DataRow[] drChanceType = dtNameCode.Select("cnvcType in ('QUESTION','VALUE')"); Hashtable htChanceType = new Hashtable(); foreach (DataRow dr in drChanceType) { NameCode tNameCode = new NameCode(dr); htChanceType.Add(tNameCode.cnvcName, tNameCode.cnvcCode); } DataRow[] drChanceSpeed = dtNameCode.Select("cnvcType = 'CHANCE_SPEED'"); Hashtable htChanceSpeed = new Hashtable(); foreach (DataRow dr in drChanceSpeed) { NameCode tNameCode = new NameCode(dr); htChanceSpeed.Add(tNameCode.cnvcName, tNameCode.cnvcCode); } DataRow[] drYesNo = dtNameCode.Select("cnvcType = 'YES_NO'"); Hashtable htYesNo = new Hashtable(); foreach (DataRow dr in drYesNo) { NameCode tNameCode = new NameCode(dr); htYesNo.Add(tNameCode.cnvcName, tNameCode.cnvcCode); } DataTable dt = ds.Tables[0]; dt.Columns.Add("校验错误"); dt.Columns.Add("cnvcDeptID"); dt.Columns.Add("cndChanceDate"); dt.Columns.Add("cnnCustID"); dt.Columns.Add("cnvcChanceName"); dt.Columns.Add("cnvcMgr"); dt.Columns.Add("cnvcTradeMgr"); dt.Columns.Add("cnvcChanceType"); dt.Columns.Add("cnnForecastIncome"); dt.Columns.Add("cnvcChanceSpeed"); dt.Columns.Add("cnvcIsSucess"); dt.Columns.Add("cnnSucessIncome"); dt.Columns.Add("cndSucessDate"); dt.Columns.Add("cnvcProjectName"); Hashtable htChanceName = new Hashtable(); foreach (DataRow dr in dt.Rows) { string strDept = dr["分公司"].ToString(); if (!htDept.ContainsKey(strDept)) { dr["校验错误"] += strDept + ":无此份公司"; iError += 1; } else { dr["cnvcDeptID"] = htDept[strDept].ToString(); } string strChanceDate = dr["商机时间"].ToString(); if (!this.JudgeIsDate(strChanceDate)) { dr["校验错误"] += strChanceDate + ":日期格式不对"; iError += 1; } else { dr["cndChanceDate"] = DateTime.Parse(strChanceDate).ToString("yyyy-MM-dd"); } string strCust = dr["客户名称"].ToString(); if (!htCust.ContainsKey(strCust)) { dr["校验错误"] += strCust + ":请先导入此客户信息"; iError += 1; } else { dr["cnnCustID"] = htCust[strCust].ToString(); } string strChanceName = dr["项目名称(商机)"].ToString().Trim(); if (strChanceName == "") { dr["校验错误"] += ":商机名称不能为空"; iError += 1; } else { dr["cnvcChanceName"] = strChanceName; } if (htChanceName.ContainsKey(strChanceName)) { dr["校验错误"] += strChanceName + ":商机名称已存在"; iError += 1; } else { htChanceName.Add(strChanceName, strChanceName); } //string strOper = dr["客户经理/行业经理"].ToString(); //string[] strOpers = strOper.Split('/'); string strMgr = dr["客户经理"].ToString(); //strOpers[0]; string strTradeMgr = dr["行业经理"].ToString(); //strOpers[1]; if (strMgr != "") { if (!htMgr.ContainsKey(strMgr)) { dr["校验错误"] += strMgr + ":无此客户经理"; iError += 1; } else { dr["cnvcMgr"] = htMgr[strMgr].ToString(); } } if (!htTradeMgr.ContainsKey(strTradeMgr)) { dr["校验错误"] += strTradeMgr + ":无此行业经理"; iError += 1; } else { dr["cnvcTradeMgr"] = htTradeMgr[strTradeMgr].ToString(); } string strChanceType = dr["商机类型"].ToString(); if (!htChanceType.ContainsKey(strChanceType)) { dr["校验错误"] += strChanceType + ":无此商机类型"; iError += 1; } else { dr["cnvcChanceType"] = htChanceType[strChanceType].ToString(); } string strForecastIncome = dr["商机预测收入(万元)"].ToString(); if (!this.JudgeIsNum(strForecastIncome)) { dr["校验错误"] += strForecastIncome + ":不是数字"; iError += 1; } else { dr["cnnForecastIncome"] = strForecastIncome; } string strChanceSpeed = dr["商机进展"].ToString(); if (!htChanceSpeed.ContainsKey(strChanceSpeed)) { dr["校验错误"] += strChanceSpeed + ":无此商机进展"; iError += 1; } else { dr["cnvcChanceSpeed"] = htChanceSpeed[strChanceSpeed].ToString(); } string strIsSucess = dr["是否成功转化"].ToString(); if (!htYesNo.ContainsKey(strIsSucess)) { dr["校验错误"] += strIsSucess + ":只有是和否"; iError += 1; } else { dr["cnvcIsSucess"] = htYesNo[strIsSucess].ToString(); } string strSucessDate = dr["成功转化时间"].ToString(); string strSucessIncome = dr["成功转换商机收入(万元/年)"].ToString(); string strProjectName = dr["(立项)项目名称"].ToString(); if (strIsSucess == "是") { if (!this.JudgeIsDate(strSucessDate)) { dr["校验错误"] += strSucessDate + ":日期格式不对"; iError += 1; } else { dr["cndSucessDate"] = DateTime.Parse(strSucessDate).ToString("yyyy-MM-dd"); } if (!this.JudgeIsNum(strSucessIncome)) { dr["校验错误"] += strSucessIncome + ":不是数字"; iError += 1; } else { dr["cnnSucessIncome"] = strSucessIncome; } if (strProjectName == "") { dr["校验错误"] += "(立项)项目名称不能为空"; iError += 1; } else { dr["cnvcProjectName"] = strProjectName; } } } this.txtError.Text = iError.ToString(); return(ds); }
public void LoadPara() { SqlConnection conn = null; //SqlTransaction trans = null; try { conn = ConnectionPool.BorrowConnection(); dtNameCode = SqlHelper.ExecuteDataTable(conn, CommandType.Text, "select * from tbNameCode"); dtMemberCode = SqlHelper.ExecuteDataTable(conn, CommandType.Text, "select * from tbMemberCode"); alMemberType.Clear(); alEnterpriseType.Clear(); alProduct.Clear(); alTrade.Clear(); DataRow[] drMemberTypes = dtNameCode.Select("cnvcType='" + MemberType + "'"); foreach (DataRow drMemberType in drMemberTypes) { NameCode nameCode = new NameCode(drMemberType); alMemberType.Add(nameCode.cnvcValue); } DataRow[] drEnterpriseTypes = dtNameCode.Select("cnvcType='" + EnterpriseType + "'"); foreach (DataRow drEnterpriseType in drEnterpriseTypes) { NameCode nameCode = new NameCode(drEnterpriseType); alEnterpriseType.Add(nameCode.cnvcValue); } DataRow[] drProducts = dtNameCode.Select("cnvcType='" + Product + "'"); foreach (DataRow drProduct in drProducts) { NameCode nameCode = new NameCode(drProduct); alProduct.Add(nameCode.cnvcValue); } DataRow[] drTrades = dtNameCode.Select("cnvcType='" + Trade + "'"); foreach (DataRow drTrade in drTrades) { NameCode nameCode = new NameCode(drTrade); alTrade.Add(nameCode.cnvcValue); } DataRow[] drJobBookDates = dtNameCode.Select("cnvcType='" + BookDate + "'"); if (drJobBookDates.Length > 0) { NameCode nameCode = new NameCode(drJobBookDates[0]); iBookDate = int.Parse(nameCode.cnvcValue); } DataRow[] drTishis = dtNameCode.Select("cnvcType='" + tishi + "'"); if (drTishis.Length > 0) { NameCode nameCode = new NameCode(drTishis[0]); iTishi = int.Parse(nameCode.cnvcValue); } DataRow[] drTouchFlash = dtNameCode.Select("cnvcType='" + TouchFlash + "'"); if (drTouchFlash.Length > 0) { NameCode nameCode = new NameCode(drTouchFlash[0]); iTouchFlash = int.Parse(nameCode.cnvcValue); } DataRow[] drTouchBookBeginDate = dtNameCode.Select("cnvcType='" + TouchBookBeginDate + "'"); if (drTouchBookBeginDate.Length > 0) { NameCode nameCode = new NameCode(drTouchBookBeginDate[0]); dTouchBookBeginDate = nameCode.cnvcValue; } DataRow[] drTouchBookEndDate = dtNameCode.Select("cnvcType='" + TouchBookEndDate + "'"); if (drTouchBookEndDate.Length > 0) { NameCode nameCode = new NameCode(drTouchBookEndDate[0]); dTouchBookEndDate = nameCode.cnvcValue; } DataRow[] drTouchSignInBeginDate = dtNameCode.Select("cnvcType='" + TouchSignInBeginDate + "'"); if (drTouchSignInBeginDate.Length > 0) { NameCode nameCode = new NameCode(drTouchSignInBeginDate[0]); dTouchSignInBeginDate = nameCode.cnvcValue; } DataRow[] drTouchSignInEndDate = dtNameCode.Select("cnvcType='" + TouchSignInEndDate + "'"); if (drTouchSignInEndDate.Length > 0) { NameCode nameCode = new NameCode(drTouchSignInEndDate[0]); dTouchSignInEndDate = nameCode.cnvcValue; } htFree.Clear(); htBookDate.Clear(); htDisabledDate.Clear(); htMemberDiscount.Clear(); htMemberSeats.Clear(); htDept.Clear(); htMemberFee.Clear(); DataRow[] drFreeTypes = dtMemberCode.Select("cnvcMemberType='" + FreeType + "'"); foreach (DataRow drFreeType in drFreeTypes) { MemberCode memberCode = new MemberCode(drFreeType); htFree.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataRow[] drBookDates = dtMemberCode.Select("cnvcMemberType='" + BookDate + "'"); foreach (DataRow drBookDate in drBookDates) { MemberCode memberCode = new MemberCode(drBookDate); htBookDate.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataRow[] drDisabledDates = dtMemberCode.Select("cnvcMemberType='" + DisabledDate + "'"); foreach (DataRow drDisabledDate in drDisabledDates) { MemberCode memberCode = new MemberCode(drDisabledDate); htDisabledDate.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataRow[] drMemberDiscounts = dtMemberCode.Select("cnvcMemberType='" + MemberDiscount + "'"); foreach (DataRow drMemberDiscount in drMemberDiscounts) { MemberCode memberCode = new MemberCode(drMemberDiscount); htMemberDiscount.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataRow[] drMemberSeats = dtMemberCode.Select("cnvcMemberType='" + MemberSeats + "'"); foreach (DataRow drMemberSeat in drMemberSeats) { MemberCode memberCode = new MemberCode(drMemberSeat); htMemberSeats.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataRow[] drMemberFees = dtMemberCode.Select("cnvcMemberType='" + MemberFee + "'"); foreach (DataRow drMemberFee in drMemberFees) { MemberCode memberCode = new MemberCode(drMemberFee); htMemberFee.Add(memberCode.cnvcMemberName, memberCode.cnvcMemberValue); } DataTable dtDept = SqlHelper.ExecuteDataTable(conn, CommandType.Text, "select * from tbDept"); foreach (DataRow drDept in dtDept.Rows) { Dept dept = new Dept(drDept); htDept.Add(dept.cnnDeptID, dept); } } catch (BusinessException bex) //业务异常 { //事务回滚 //trans.Rollback(); //LogAdapter.WriteBusinessException(bex); throw new BusinessException(bex.Type, bex.Message); } catch (SqlException sex) //数据库异常 { //事务回滚 //trans.Rollback(); //LogAdapter.WriteDatabaseException(sex); throw new BusinessException("数据库异常", sex.Message); } catch (Exception ex) //其他异常 { //事务回滚 //trans.Rollback(); //LogAdapter.WriteFeaturesException(ex); throw new BusinessException("其它异常", ex.Message); } finally { ConnectionPool.ReturnConnection(conn); } }