예제 #1
0
        //2015.6增加银行代收功能后,完善用户信息
        private void add_Click(object sender, EventArgs e)
        {
            Boolean success = false;

            success = checkInfo();
            //如果验证不成功
            if (success == false)
            {

            }
            else
            {
                Customer customer = new Customer();
                Countfeeinfo countfeeinfo = new Countfeeinfo();
                List<Object> list = new List<object>();
                //string customerPosition1 = "";
                //string customerPosition2 = "";
                decimal customerPosition1 = 0;
                decimal customerPosition2 = 0;
                if (this.CustomInfoList.SelectedIndex == -1)
                {
                    MessageBox.Show("选择要添加客户成员的位置");
                    return;
                }

                /* 计算新添加客户的位置 */
                if (this.CustomInfoList.Items.Count == (this.CustomInfoList.SelectedIndex + 1))
                {
                    if (this.customerAction.getCustomerPositionById(this.CustomInfoList.SelectedItem.ToString().Split(' ')[3], ref customerPosition1) == Constant.OK)
                    {
                        customer.setCustomerPosition(customerPosition1 + 1);
                    }
                }

                else
                {
                    if (this.customerAction.getCustomerPositionById(this.CustomInfoList.SelectedItem.ToString().Split(' ')[3], ref customerPosition1) == Constant.OK && this.customerAction.getCustomerPositionById(this.CustomInfoList.Items[this.CustomInfoList.SelectedIndex + 1].ToString().Split(' ')[3], ref customerPosition2) == Constant.OK)
                    {
                        customer.setCustomerPosition((customerPosition1 + customerPosition2) / 2);
                    }
                }

                if ("" == this.CustomerCode_1.Text.ToString().Trim())
                {
                    MessageBox.Show("请选择账本信息和所要插入的位置!");
                    return;
                }

                if ("" == this.CustomerCode_2.Text.ToString().Trim())
                {
                    MessageBox.Show("填写客户编码!");
                    return;
                }
                customer.setCustomerNo(this.CustomerCode_1.Text.ToString().Trim() + this.CustomerCode_2.Text.ToString().Trim());

                if ("" == this.CustomerName.Text.ToString().Trim())
                {
                    MessageBox.Show("请输入客户名称");
                    return;
                }
                customer.setCustomerName(this.CustomerName.Text.ToString().Trim());

                customer.setCustomerAddress(this.CustomerAddress.Text.ToString());

                customer.setPhoneNum(this.txtPhoneNum.Text.ToString());

                customer.setLine(this.Line.SelectedValue.ToString().Trim());

                customer.setAmmeterType(this.cbxAmmeterType1.SelectedItem.ToString());
                customer.setAmmeterNo(this.txtAmmeterNo1.Text.ToString());

                customer.setArea(this.AreaType.SelectedItem.ToString().Trim().Split(' ')[0]);

                customer.setElectriCharacterName(this.ElectriType.SelectedItem.ToString().Trim());

                customer.setVoltageFlag(this.VoltageFlag.SelectedItem.ToString().Trim());

                customer.setInvoiceType(this.InvoiceType.SelectedItem.ToString().Trim());

                //设置身份证号
                customer.setIdentificationCard(this.identificationCard.Text.ToString().Trim());

                //设置签约标志信息
                if (this.sign.Checked)
                {
                    customer.setSignFlag("1");
                }
                else
                {
                    customer.setSignFlag("0");
                }

                customer.setOrganFlag("0");

                customer.setEspecialFlag("0");
                if (this.cbxSpecialFlag.Checked)
                {
                    customer.setEspecialFlag("1");
                }

                customer.setBankAccount(this.BankAccount.Text.ToString().Trim());

                customer.setBankCode(this.BankCode.Text.ToString().Trim());

                customer.setBankName(this.Bank.Text.ToString().Trim());

                customer.setTradeCode("");

                customer.setValueAddTaxNo("");

                if (this.LowProtect.Checked)
                {
                    customer.setLowProtectFlag("1");
                }
                else
                {
                    customer.setLowProtectFlag("0");
                }

                if (this.BasicEFee.Checked)
                {
                    customer.setTranslossOrBaseprice("1");
                }
                else
                {
                    customer.setTranslossOrBaseprice("0");
                }

                customer.setPassword(this.CustomerCode_1.Text.ToString().Trim() + this.CustomerCode_2.Text.ToString().Trim());

                countfeeinfo.setCustomerNo(customer.getCustomerNo());
                if (null == this.Transformer.SelectedItem || -1 == int.Parse(this.Transformer.SelectedItem.ToString().Trim().Split(' ')[0]))
                {
                    countfeeinfo.setTransformerNo("0");
                }
                else
                {
                    countfeeinfo.setTransformerNo(this.Transformer.SelectedItem.ToString().Trim().Split(' ')[0]);
                }

                countfeeinfo.setAmmeterMulti(this.Multi.Text.ToString().Trim());

                countfeeinfo.setLineLoseRate(this.LineLoseRate.Text.ToString().Trim());

                if ("" == this.Discount.Text.ToString().Trim())
                {
                    countfeeinfo.setDiscountRate("0");
                }
                else
                {
                    countfeeinfo.setDiscountRate(this.Discount.Text.ToString().Trim());
                }

                list.Add((Object)customer);
                list.Add((Object)countfeeinfo);

                /* 检验该客户编号是否存在 */

                bool state = false;
                if (Constant.OK == this.customerAction.customerNoChecking(customer.getCustomerNo(), ref state))
                {
                    if (!state)
                    {
                        MessageBox.Show("该编号已经存在");
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("数据库执行出错");
                    return;
                }

                /* 添加电价比率信息 */
                if (this.PowerPrice_1.SelectedIndex != -1)
                {
                    PriceRate pr_1 = new PriceRate();
                    pr_1.PriceNo = int.Parse(this.PowerPrice_1.SelectedValue.ToString());
                    pr_1.Rate = float.Parse(this.Price1.Text.ToString().Trim());
                    pr_1.PriceName = customer.getCustomerNo();
                    list.Add((Object)pr_1);
                }
                if (this.PowerPrice_2.SelectedIndex != -1)
                {
                    PriceRate pr_2 = new PriceRate();
                    pr_2.PriceNo = int.Parse(this.PowerPrice_2.SelectedValue.ToString());
                    pr_2.Rate = float.Parse(this.Price2.Text.ToString().Trim());
                    pr_2.PriceName = customer.getCustomerNo();
                    list.Add((Object)pr_2);
                }
                if (this.PowerPrice_3.SelectedIndex != -1)
                {
                    PriceRate pr_3 = new PriceRate();
                    pr_3.PriceNo = int.Parse(this.PowerPrice_3.SelectedValue.ToString());
                    pr_3.Rate = float.Parse(this.Price3.Text.ToString().Trim());
                    pr_3.PriceName = customer.getCustomerNo();
                    list.Add((Object)pr_3);
                }
                if (this.PowerPrice_4.SelectedIndex != -1)
                {
                    PriceRate pr_4 = new PriceRate();
                    pr_4.PriceNo = int.Parse(this.PowerPrice_4.SelectedValue.ToString());
                    pr_4.Rate = float.Parse(this.Price4.Text.ToString().Trim());
                    pr_4.PriceName = customer.getCustomerNo();
                    list.Add((Object)pr_4);

                }

                /*添加客户信息*/
                if (Constant.OK == this.customerAction.addCustomerInfo(ref list))
                {
                    MessageBox.Show("客户信息添加成功");
                    this.init_content();
                    return;
                }
                else
                {
                    MessageBox.Show("客户信息添加失败");
                    return;
                }

                /*添加客户计费信息
                if (Constant.OK == this.customerAction.addCountfeeinfo(ref countfeeinfo))
                {
                }
                else
                {
                }
                */
            }
        }
예제 #2
0
        private void UpdateInfo_Click(object sender, EventArgs e)
        {
            Boolean success = false;

            success= checkInfo();
            //如果验证不成功
            if (success == false) {

            }
            else{
            List<Object> list =  new List<object>();

            if ("" != this.CustomInfoList.SelectedItem.ToString().Split(' ')[3])
            {
                /*this.customerName.Text = customer.getCustomerName();
                //this.ammeterMutiple.Text = customer.getAmmeterType();
                this.customer.setLine(this.line.Text.ToString());
                this.customer.seArea this.area.Text = customer.getArea();
                this.invoiceNo.Text = customer.getInvoiceType();
                this.electriType.Text = customer.getElectriCharacterName();
                this.voltage.Text = customer.getVoltageFlag();
                this.ammeterMutiple.Text = countfeeinfo.getAmmeterMulti();
                this.lineChange.Text = countfeeinfo.getLineLoseRate();
                this.transformer.Text = countfeeinfo.getTransformerNo();*/
                customer.setCustomerName(customerName.Text.ToString().Trim());

                this.customer.setLine(this.LineBox.SelectedValue.ToString());       //线路

                this.customer.setArea(this.AreaBox.SelectedValue.ToString());       //台区

                this.customer.setElectriCharacterName(this.ElectriType.SelectedItem.ToString());       //用电性质

                this.customer.setInvoiceType(this.InvoiceType.SelectedItem.ToString());     //发票类型

                this.customer.setVoltageFlag(this.VoltageFlag.SelectedItem.ToString());     //是否高压电

                customer.setAmmeterType(this.cbxAmmeterType1.SelectedItem.ToString());
                customer.setAmmeterNo(this.txtAmmeterNo1.Text.ToString());

                this.customer.setBankAccount(this.BankAccount.Text.ToString().Trim());      //银行账号

                this.customer.setBankCode(this.BankCode.Text.ToString().Trim());            //银行代码
                /**
                 * 另外一些数据后面再补
                 **/

                //设置身份证号
                customer.setIdentificationCard(this.IdentificationCard.Text.ToString().Trim());

                //设置签约标志信息
                if (Sign.Checked)
                {
                    customer.setSignFlag("1");
                }
                else
                {
                    customer.setSignFlag("0");
                }

                if (this.Transformer.SelectedIndex != -1 && this.Transformer.SelectedItem.ToString().Trim() != "")
                {
                    this.countfeeinfo.setTransformerNo(this.Transformer.SelectedValue.ToString());
                }
                else
                {
                    this.countfeeinfo.setTransformerNo("0");
                }

                this.customer.setCustomerName(this.customerName.Text.ToString());

                if (this.LowProtect.Checked)
                {
                    this.customer.setLowProtectFlag("1");

                }
                else
                {
                    this.customer.setLowProtectFlag("0");
                }

                if (this.BasicEFee.Checked)
                {
                    this.customer.setTranslossOrBaseprice("1");

                }
                else
                {
                    this.customer.setTranslossOrBaseprice("0");
                }
                this.countfeeinfo.setAmmeterMulti(this.ammeterMutiple.Text.ToString());
                this.countfeeinfo.setLineLoseRate(this.lineChange.Text.ToString());
                this.customer.setCustomerAddress(this.CustomerAddress.Text.ToString().Trim());
                this.customer.setPhoneNum(this.txtPhoneNum.Text.ToString().Trim());

                if ("" == this.discountRate.Text.ToString().Trim())
                {
                    countfeeinfo.setDiscountRate("0");
                }
                else
                {
                    countfeeinfo.setDiscountRate(this.discountRate.Text.ToString().Trim());
                }

                list.Add((Object)this.customer);
                list.Add((Object)this.countfeeinfo);

                if (this.PowerPrice_1.SelectedIndex != -1)
                {
                    PriceRate pr_1 = new PriceRate();
                    pr_1.PriceNo = int.Parse(this.PowerPrice_1.SelectedValue.ToString());
                    pr_1.Rate = float.Parse(this.PowerRate_1.Text.ToString().Trim());
                    list.Add((Object)pr_1);
                }
                if (this.PowerPrice_2.SelectedIndex != -1)
                {
                    PriceRate pr_2 = new PriceRate();
                    pr_2.PriceNo = int.Parse(this.PowerPrice_2.SelectedValue.ToString());
                    pr_2.Rate = float.Parse(this.PowerRate_2.Text.ToString().Trim());
                    list.Add((Object)pr_2);
                }
                if (this.PowerPrice_3.SelectedIndex != -1)
                {
                    PriceRate pr_3 = new PriceRate();
                    pr_3.PriceNo = int.Parse(this.PowerPrice_3.SelectedValue.ToString());
                    pr_3.Rate = float.Parse(this.PowerRate_3.Text.ToString().Trim());
                    list.Add((Object)pr_3);
                }
                if (this.PowerPrice_4.SelectedIndex != -1)
                {
                    PriceRate pr_4 = new PriceRate();
                    pr_4.PriceNo = int.Parse(this.PowerPrice_4.SelectedValue.ToString());
                    pr_4.Rate = float.Parse(this.PowerRate_4.Text.ToString().Trim());
                    list.Add((Object)pr_4);
                }

                //MessageBox.Show(this.CustomInfoList.SelectedItem.ToString().Split(' ')[3]);
                if (Constant.OK == this.customerAction.updateInfoById(this.CustomInfoList.SelectedItem.ToString().Split(' ')[3], ref list))
                {
                    MessageBox.Show("更新成功!");
                }
                else
                {
                    MessageBox.Show("更新失败!");

                }

            }
            }
        }
예제 #3
0
        private void addButton_Click(object sender, EventArgs e)
        {
            Customer customer = new Customer();
            Countfeeinfo countfeeinfo = new Countfeeinfo();
            List<Object> list = new List<object>();

            /* 设置客户的位置信息 */
            customer.setCustomerPosition(1);

            customer.setCustomerNo(this.CustomerCode_new.Text.ToString().Trim());

            if ("" == this.CustomerName_new.Text.ToString().Trim())
            {
                MessageBox.Show("请输入客户名称!");
                return;
            }
            customer.setCustomerName(this.CustomerName_new.Text.ToString().Trim());

            customer.setCustomerAddress(this.CustomerAddress_new.Text.ToString());

            customer.setPhoneNum(this.txtPhoneNum2.Text.ToString());

            customer.setLine(this.Line_new.SelectedValue.ToString().Trim());

            customer.setArea(this.Area_new.SelectedItem.ToString().Trim().Split(' ')[0]);

            customer.setAmmeterType(this.cbxAmmeterType2.SelectedItem.ToString());
            customer.setAmmeterNo(this.txtAmmeterNo2.Text.ToString());
            customer.setElectriCharacterName(this.Electri_new.SelectedItem.ToString().Trim());

            customer.setVoltageFlag(this.VoltageFlag_new.SelectedItem.ToString().Trim());

            customer.setInvoiceType(this.InvoiceType_new.SelectedItem.ToString().Trim());

            //设置身份证号
            customer.setIdentificationCard(this.identificationCard.Text.ToString().Trim());

            //设置签约标志信息
            if (this.sign.Checked)
            {
                customer.setSignFlag("1");
            }
            else
            {
                customer.setSignFlag("0");
            }

            customer.setOrganFlag("0");

            customer.setEspecialFlag("0");
            if (this.cbxSpecialFlag.Checked)
            {
                customer.setEspecialFlag("1");
            }

            customer.setBankAccount(this.BankAccount_new.Text.ToString().Trim());

            customer.setBankCode(this.BankCode_new.Text.ToString().Trim());

            customer.setBankName(this.BankName_new.Text.ToString().Trim());

            customer.setTradeCode("");

            customer.setValueAddTaxNo("");

            customer.setPassword(this.CustomerCode_new.Text.ToString().Trim());

            if (this.LowProtect.Checked)
            {
                customer.setLowProtectFlag("1");
            }
            else
            {
                customer.setLowProtectFlag("0");
            }

            if (this.BasicEFee.Checked)
            {
                customer.setTranslossOrBaseprice("1");
            }
            else
            {
                customer.setTranslossOrBaseprice("0");
            }

            countfeeinfo.setCustomerNo(customer.getCustomerNo());
            if (null == this.Transformer_new.SelectedItem || -1 == int.Parse(this.Transformer_new.SelectedItem.ToString().Trim().Split(' ')[0]))
            {
                countfeeinfo.setTransformerNo("0");
            }
            else
            {
                countfeeinfo.setTransformerNo(this.Transformer_new.SelectedItem.ToString().Trim().Split(' ')[0]);
            }

            countfeeinfo.setAmmeterMulti(this.Multip_new.Text.ToString().Trim());

            countfeeinfo.setLineLoseRate(this.LineLoseRate_new.Text.ToString().Trim());

            if ("" == this.Discount_new.Text.ToString().Trim())
            {
                countfeeinfo.setDiscountRate("0");
            }
            else
            {
                countfeeinfo.setDiscountRate(this.Discount_new.Text.ToString().Trim());
            }

            list.Add((Object)customer);
            list.Add((Object)countfeeinfo);

            /* 检验该该账本编号是否存在 */

            bool state = false;
            if (Constant.OK == this.customerAction.bookTypeChecking(customer.getCustomerNo(), ref state))
            {
                if (!state)
                {
                    MessageBox.Show("该账簿号已经存在");
                    return;
                }

            }
            else
            {
                MessageBox.Show("数据库执行出错");
                return;
            }

            /* 添加电价比率信息 */
            if (this.PowerPrice1_new.SelectedIndex != -1)
            {
                PriceRate pr_1 = new PriceRate();
                pr_1.PriceNo = int.Parse(this.PowerPrice1_new.SelectedValue.ToString());
                pr_1.Rate = float.Parse(this.Price1_new.Text.ToString().Trim());
                pr_1.PriceName = customer.getCustomerNo();
                list.Add((Object)pr_1);
            }
            if (this.PowerPrice2_new.SelectedIndex != -1)
            {
                PriceRate pr_2 = new PriceRate();
                pr_2.PriceNo = int.Parse(this.PowerPrice2_new.SelectedValue.ToString());
                pr_2.Rate = float.Parse(this.Price2_new.Text.ToString().Trim());
                pr_2.PriceName = customer.getCustomerNo();
                list.Add((Object)pr_2);
            }
            if (this.PowerPrice3_new.SelectedIndex != -1)
            {
                PriceRate pr_3 = new PriceRate();
                pr_3.PriceNo = int.Parse(this.PowerPrice3_new.SelectedValue.ToString());
                pr_3.Rate = float.Parse(this.Price3_new.Text.ToString().Trim());
                pr_3.PriceName = customer.getCustomerNo();
                list.Add((Object)pr_3);
            }
            if (this.PowerPrice4_new.SelectedIndex != -1)
            {
                PriceRate pr_4 = new PriceRate();
                pr_4.PriceNo = int.Parse(this.PowerPrice4_new.SelectedValue.ToString());
                pr_4.Rate = float.Parse(this.Price4_new.Text.ToString().Trim());
                pr_4.PriceName = customer.getCustomerNo();
                list.Add((Object)pr_4);

            }

            /*添加客户信息*/
            if (Constant.OK == this.customerAction.addCustomerInfo(ref list))
            {
                MessageBox.Show("客户信息添加成功");
                this.init_content();
                return;
            }
            else
            {
                MessageBox.Show("客户信息添加失败");
                return;
            }
        }