コード例 #1
0
 private void cmbCustomerName_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (cmbCustomerName.SelectedIndex > -1)
     {
         var table = new T_CustomersTableAdapter().GetDataById((long)cmbCustomerName.SelectedValue);
     }
 }
コード例 #2
0
        private void cmbUsername_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable mTable = null;

            if (cmbUsername.SelectedIndex > 0)
            {
                long saleId = ((销售管理.Classes.PubClass.MyCmbList)cmbUsername.SelectedItem).Id;
                mTable = new T_CustomersTableAdapter().GetDataByUserId(saleId);
            }
            else
            {
                mTable = new T_CustomersTableAdapter().GetData();
            }
            txtCustomer.DataSource    = mTable;
            txtCustomer.SelectedIndex = -1;
        }
コード例 #3
0
        private void cmbUserName_SelectionChangeCommitted(object sender, EventArgs e)
        {
            //cmbCustomerName.DataSource = null;
            //if (cmbUserName.SelectedIndex > -1)
            //{
            //    cmbCustomerName.DisplayMember = "CompanyName";
            //    cmbCustomerName.ValueMember = "id";
            //    cmbCustomerName.DataSource = new T_CustomersTableAdapter().GetDataByUserId((long)cmbUserName.SelectedValue);
            //    cmbCustomerName.SelectedIndex = -1;
            //}

            cmbCustomerName.Text         = "";
            Classes.PubClass.CompanyName = "";

            if (cmbUserName.SelectedIndex > -1)
            {
                Classes.PubClass.UserId = (long)cmbUserName.SelectedValue;
                CustomerNameList mForm = new CustomerNameList();
                mForm.ShowDialog();
            }

            if (Classes.PubClass.CompanyName != "")
            {
                cmbCustomerName.Text = Classes.PubClass.CompanyName;
                var table = new T_CustomersTableAdapter().GetDataById((long)Classes.PubClass.CompanyId);
                if (table.Rows.Count > 0)
                {
                    if (((销售管理.DAL.DataSetCustomers.T_CustomersRow)table.Rows[0]).IsCityIDNull() == true)
                    {
                        MessageBox.Show("请先设置该客户所在地区");
                        btnSave.Enabled = false;
                    }
                    else
                    {
                        btnSave.Enabled = true;
                    }
                    CityId = ((销售管理.DAL.DataSetCustomers.T_CustomersRow)table.Rows[0]).IsCityIDNull() == true ? -1 : ((销售管理.DAL.DataSetCustomers.T_CustomersRow)table.Rows[0]).CityID;
                }
                else
                {
                    CityId = -1;
                }
            }
        }
コード例 #4
0
        private void cmbUsername_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbCompanyName.DisplayMember = "CompanyName";
            cmbCompanyName.ValueMember   = "Id";
            DataTable mTable;

            if (cmbUsername.Text != "查询所有" && cmbUsername.Text != "")
            {
                mTable = new T_CustomersTableAdapter().GetDataByUserId(Convert.ToInt64((cmbUsername.SelectedItem as Classes.PubClass.MyCmbList).Id));
            }
            else
            {
                mTable = new T_CustomersTableAdapter().GetData();
            }
            销售管理.DAL.DataSetCustomers.T_CustomersRow mDataRow = (销售管理.DAL.DataSetCustomers.T_CustomersRow)mTable.NewRow();
            mDataRow.id          = 0;
            mDataRow.CompanyName = "全部";
            mTable.Rows.InsertAt(mDataRow, 0);
            cmbCompanyName.DataSource    = mTable;
            cmbCompanyName.SelectedIndex = -1;
        }
コード例 #5
0
ファイル: 销售明细录入.cs プロジェクト: zymITsky/ss
 private void cmbCustomerName_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (cmbCustomerName.SelectedIndex > -1)
     {
         var table = new T_CustomersTableAdapter().GetDataById((long)cmbCustomerName.SelectedValue);
         if (table.Rows.Count > 0)
         {
             if (((销售管理.DAL.DataSetCustomers.T_CustomersRow)table.Rows[0]).IsCityIDNull() == true)
             {
                 MessageBox.Show("请先设置该客户所在地区");
                 btnSave.Enabled = false;
             }
             else
             {
                 btnSave.Enabled = true;
             }
             CityId = ((销售管理.DAL.DataSetCustomers.T_CustomersRow)table.Rows[0]).IsCityIDNull() == true ? -1 : ((销售管理.DAL.DataSetCustomers.T_CustomersRow)table.Rows[0]).CityID;
         }
         else
         {
             CityId = -1;
         }
     }
 }
コード例 #6
0
ファイル: 申请费用分配.cs プロジェクト: zymITsky/ss
        public DateTime DeliverDate;  //发货日期

        private void 申请费用分配_Load(object sender, EventArgs e)
        {
            rbPersonal.Checked = true;
            isLoading          = true;


            if (ExId > -1)   //如果费用分配ID大于-1,查看费用分配信息
            {
                DataTable mTable1 = new T_ExpenseAllocationTableAdapter().GetDataById(ExId);
                if (mTable1.Rows.Count > 0)
                {
                    var mDataRow = (销售管理.DAL.DataSetExpenseAllocation.T_ExpenseAllocationRow)mTable1.Rows[0];
                    //cmbMonth.SelectedItem = mDataRow.Month;
                    //txtTableNo.Text = mDataRow.TableNo;
                    //txtCustomerName.Text = mDataRow.CustomerName;
                    txtProjectName.Text = mDataRow.ProjectName;
                    var mProductTable = new T_ProductsTableAdapter().GetDataByID(mDataRow.ProductName);
                    if (mProductTable.Rows.Count > 0)
                    {
                        txtProductName.Text = mProductTable[0].Name;
                    }
                    var mCustomerTable = new T_CustomersTableAdapter().GetDataById(Convert.ToInt64(mDataRow.CustomerName));
                    if (mProductTable.Rows.Count > 0)
                    {
                        txtCustomerName.Text = mCustomerTable[0].CompanyName;
                    }

                    var mSaleDetailsTable = new T_SaleDetailsTableAdapter().GetDataByExId(ExId);
                    if (mSaleDetailsTable.Rows.Count > 0)
                    {
                        DeliverDate = mSaleDetailsTable[0].SaleDate;
                    }
                    txtProductName.Tag      = mDataRow.ProductName;
                    txtCustomerName.Tag     = mDataRow.CustomerName;
                    txtType.Text            = mDataRow.ProductType;
                    txtAmount.Text          = mDataRow.Amount.ToString();
                    txtDeliverPrice.Text    = mDataRow.DeliverPrice.ToString();
                    txtDeliverSum.Text      = mDataRow.DeliverSum.ToString();
                    txtSalePrice.Text       = mDataRow.SalePrice.ToString();
                    txtSaleSum.Text         = mDataRow.SaleSum.ToString();
                    txtSaleWages.Text       = mDataRow.SaleWages.ToString();
                    txtCommissionPrice.Text = mDataRow.CommissionPrice.ToString();
                    txtCommissionSum.Text   = mDataRow.CommissionSum.ToString();
                    txtSaleCommission.Text  = mDataRow.SaleComission.ToString();
                    txtAgentPrice.Text      = mDataRow.AgentPrice.ToString();
                    txtAgentSum.Text        = mDataRow.AgentSum.ToString();
                    txtAgentCommission.Text = mDataRow.AgentCommission.ToString();

                    SalerId = mDataRow.UserName;
                    DataTable mTable = new T_UsersTableAdapter().GetDataById(SalerId);
                    if (mTable.Rows.Count > 0)
                    {
                        var mDataRow1 = (销售管理.DAL.DataSetUsers.T_UsersRow)mTable.Rows[0];
                        txtUserName.Text = mDataRow1.UserName;
                    }

                    if (mDataRow.type == "个人订单")
                    {
                        rbPersonal.Checked = true;
                    }
                    else if (mDataRow.type == "部门订单")
                    {
                        rbDepart.Checked = true;
                    }
                    else if (mDataRow.type == "公司跟单")
                    {
                        rbCompany.Checked = true;
                    }
                    else
                    {
                        rbCity.Checked = true;
                    }
                    if (mDataRow.IsCitySalerNull() == false)
                    {
                        if (mDataRow.CitySaler != "0")
                        {
                            cmbUserName.SelectedValue = Convert.ToInt64(mDataRow.CitySaler);
                        }
                    }
                    txtCitySum.Text   = mDataRow.CitySum;
                    txtCityWages.Text = mDataRow.CityWages;
                    if (mDataRow.IsCitySalePriceNull() == false)
                    {
                        txtCitySalePrice.Text = mDataRow.CitySalePrice.ToString();
                    }
                    if (mDataRow.IsCitySaleSumNull() == false)
                    {
                        txtCitySaleSum.Text = mDataRow.CitySaleSum.ToString();
                    }
                    if (mDataRow.IsCitySaleCommissionNull() == false)
                    {
                        txtCitySaleCommission.Text = mDataRow.CitySaleCommission.ToString();
                    }
                    oldType         = mDataRow.type;
                    FailTableNo     = mDataRow.TableNo;
                    txtTableNo.Text = mDataRow.TableNo;

                    if (mDataRow.IsPaid == "已付款")
                    {
                        cbIsPaid.Checked = true;
                        if (mDataRow.IsPaidDateNull() == false)
                        {
                            dtpPaidDate.Value = mDataRow.PaidDate;
                        }
                    }
                    else
                    {
                        cbIsPaid.Checked = false;
                    }

                    if (mDataRow.IsHasTaxNull() == false)
                    {
                        if (mDataRow.HasTax == "含税")
                        {
                            cbTax.Checked = true;
                        }
                        else
                        {
                            cbTax.Checked = false;
                        }
                    }
                    else
                    {
                        cbTax.Checked = false;
                    }
                    txtStatus.Text = mDataRow.Status;//+"。" + mDataRow.BusinessRemark;

                    labStatus.Visible = true;
                    txtStatus.Visible = true;
                    btnApply.Enabled  = false;
                    //label12.Visible = true;
                    //dtpPaidDate.Visible = true;
                    cbIsPaid.Visible = true;

                    if (mDataRow.Status.Contains("不通过") == true && isModify == true)
                    {
                        btnApply.Enabled = true;
                        btnApply.Text    = "重新申请";
                        cbIsPaid.Visible = false;
                    }
                    else
                    {
                        btnApply.Enabled = false;
                    }
                    //groupBox1.Enabled = false;
                }
                else
                {
                    MessageBox.Show("该费用分配表号不存在");
                    this.Close();
                    return;
                }

                if (Classes.PubClass.UserRight == "领导" || Classes.PubClass.UserRight == "超级管理员" || Classes.PubClass.UserRight == "商务经理")
                {
                    btnModifyPaid.Visible = true;
                }
                else
                {
                    btnModifyPaid.Visible = false;
                }
            }
            else  //申请费用分配
            if (mRow != null)
            {
                DeliverDate          = Convert.ToDateTime(mRow.Cells["saleDateDataGridViewTextBoxColumn"].Value);
                txtCustomerName.Text = mRow.Cells["customerNameDataGridViewTextBoxColumn"].Value.ToString();
                txtProductName.Text  = mRow.Cells["productNameDataGridViewTextBoxColumn"].Value.ToString();
                txtAmount.Text       = mRow.Cells["amountDataGridViewTextBoxColumn"].Value.ToString();
                //cmbMonth.SelectedItem = mRow.Cells["saleMonthDataGridViewTextBoxColumn"].Value.ToString();
                txtDeliverPrice.Text = mRow.Cells["priceDataGridViewTextBoxColumn"].Value.ToString();
                long SaleDetailsId    = Convert.ToInt64(mRow.Cells["idDataGridViewTextBoxColumn"].Value);
                var  SaleDetailsTable = new T_SaleDetailsTableAdapter().GetDataById(SaleDetailsId);
                if (SaleDetailsTable.Rows.Count > 0)
                {
                    txtProductName.Tag  = SaleDetailsTable[0].ProductName;
                    txtCustomerName.Tag = SaleDetailsTable[0].CustomerName;
                    SalerId             = SaleDetailsTable[0].UserName;
                    var mUserTable = new T_UsersTableAdapter().GetDataById(SalerId);
                    if (mUserTable.Rows.Count > 0)
                    {
                        txtUserName.Text = mUserTable[0].UserName;
                    }
                    SetTableNo();
                }
                btnModifyPaid.Visible = false;
            }

            isLoading = false;
        }
コード例 #7
0
        public string oldType;        //原订单类型
        private void Form1_Load(object sender, EventArgs e)
        {
            DataTable mTable1  = new T_ExpenseAllocationTableAdapter().GetDataById(ExId);
            var       mDataRow = (销售管理.DAL.DataSetExpenseAllocation.T_ExpenseAllocationRow)mTable1.Rows[0];

            //cmbMonth.SelectedItem = mDataRow.Month;
            //txtTableNo.Text = mDataRow.TableNo;
            //txtCustomerName.Text = mDataRow.CustomerName;
            txtProjectName.Text = mDataRow.ProjectName;
            var mProductTable = new T_ProductsTableAdapter().GetDataByID(mDataRow.ProductName);

            if (mProductTable.Rows.Count > 0)
            {
                txtProductName.Text = mProductTable[0].Name;
            }
            var mCustomerTable = new T_CustomersTableAdapter().GetDataById(Convert.ToInt64(mDataRow.CustomerName));

            if (mProductTable.Rows.Count > 0)
            {
                txtCustomerName.Text = mCustomerTable[0].CompanyName;
            }
            txtProductName.Tag      = mDataRow.ProductName;
            txtCustomerName.Tag     = mDataRow.CustomerName;
            txtType.Text            = mDataRow.ProductType;
            txtAmount.Text          = mDataRow.Amount.ToString();
            txtDeliverPrice.Text    = mDataRow.DeliverPrice.ToString();
            txtDeliverSum.Text      = mDataRow.DeliverSum.ToString();
            txtSalePrice.Text       = mDataRow.SalePrice.ToString();
            txtSaleSum.Text         = mDataRow.SaleSum.ToString();
            txtSaleWages.Text       = mDataRow.SaleWages.ToString();
            txtCommissionPrice.Text = mDataRow.CommissionPrice.ToString();
            txtCommissionSum.Text   = mDataRow.CommissionSum.ToString();
            txtSaleCommission.Text  = mDataRow.SaleComission.ToString();
            txtAgentPrice.Text      = mDataRow.AgentPrice.ToString();
            txtAgentSum.Text        = mDataRow.AgentSum.ToString();
            txtAgentCommission.Text = mDataRow.AgentCommission.ToString();

            SalerId = mDataRow.UserName;
            DataTable mTable = new T_UsersTableAdapter().GetDataById(SalerId);

            if (mTable.Rows.Count > 0)
            {
                var mDataRow1 = (销售管理.DAL.DataSetUsers.T_UsersRow)mTable.Rows[0];
                txtUserName.Text = mDataRow1.UserName;
            }

            if (mDataRow.type == "个人订单")
            {
                rbPersonal.Checked = true;
            }
            else if (mDataRow.type == "部门订单")
            {
                rbDepart.Checked = true;
            }
            else if (mDataRow.type == "公司跟单")
            {
                rbCompany.Checked = true;
            }
            else
            {
                rbCity.Checked = true;
            }
            if (mDataRow.IsCitySalerNull() == false)
            {
                if (mDataRow.CitySaler != "0")
                {
                    cmbUserName.SelectedValue = Convert.ToInt64(mDataRow.CitySaler);
                }
            }
            oldType         = mDataRow.type;
            FailTableNo     = mDataRow.TableNo;
            txtTableNo.Text = mDataRow.TableNo;

            if (mDataRow.IsPaid == "已付款")
            {
                cbIsPaid.Checked = true;
            }
            else
            {
                cbIsPaid.Checked = false;
            }
            if (mDataRow.IsPaidDateNull() == false)
            {
                dtpPaidDate.Value = mDataRow.PaidDate;
            }

            txtStatus.Text = mDataRow.Status;        //+"。" + mDataRow.BusinessRemark;

            labStatus.Visible = true;
            txtStatus.Visible = true;
            btnApply.Enabled  = true;

            if (mDataRow.Status.Contains("不通过") == true && isModify == true)
            {
                btnApply.Enabled = true;
                btnApply.Text    = "重新申请";
            }
            else
            {
                btnApply.Enabled = true;
            }
            //groupBox1.Enabled = false;
        }
コード例 #8
0
ファイル: 客户资料维护.cs プロジェクト: zymITsky/ss
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cmbPromary.SelectedIndex < 0)
            {
                toolTip1.Show("请选择公司所在区域!", cmbPromary, 0, cmbPromary.Height, 2000);
                return;
            }
            if (string.IsNullOrEmpty(txtComName.Text.Trim()) == true)
            {
                toolTip1.Show("请输入公司名称!", txtComName, 0, txtComName.Height, 2000);
                return;
            }
            if (cmbCity.SelectedIndex == -1)
            {
                toolTip1.Show("请选择公司所在区域", cmbCity, 0, cmbCity.Height, 2000);
                return;
            }
            if (string.IsNullOrEmpty(txtComAddr.Text.Trim()) == true)
            {
                toolTip1.Show("请输入公司地址!", txtComAddr, 0, txtComAddr.Height, 2000);
                return;
            }
            if (string.IsNullOrEmpty(txtBusinessName.Text.Trim()) == true)
            {
                toolTip1.Show("请输入商务负责人!", txtBusinessName, 0, txtBusinessName.Height, 2000);
                return;
            }
            if (string.IsNullOrEmpty(txtBusinessTel.Text.Trim()) == true)
            {
                toolTip1.Show("请输入商务负责人座机!", txtBusinessTel, 0, txtBusinessTel.Height, 2000);
                return;
            }
            if (string.IsNullOrEmpty(txtBusinessPhone.Text.Trim()) == true)
            {
                toolTip1.Show("请输入商务负责人手机!", txtBusinessPhone, 0, txtBusinessPhone.Height, 2000);
                return;
            }
            if (string.IsNullOrEmpty(txtBusinessEmail.Text.Trim()) == true)
            {
                toolTip1.Show("请输入商务负责人邮箱!", txtBusinessEmail, 0, txtBusinessEmail.Height, 2000);
                return;
            }
            if (string.IsNullOrEmpty(txtDeliverName.Text.Trim()) == true)
            {
                toolTip1.Show("请输入收件人!", txtDeliverName, 0, txtDeliverName.Height, 2000);
                return;
            }
            if (string.IsNullOrEmpty(txtDeliverPhone.Text.Trim()) == true)
            {
                toolTip1.Show("请输入收件人手机!", txtDeliverPhone, 0, txtDeliverPhone.Height, 2000);
                return;
            }
            if (string.IsNullOrEmpty(txtDeliverAddr.Text.Trim()) == true)
            {
                toolTip1.Show("请输入收件人地址!", txtDeliverAddr, 0, txtDeliverAddr.Height, 2000);
                return;
            }

            if (mId > -1)
            {
                T_CustomersTableAdapter adapter = new T_CustomersTableAdapter();
                var mTable = adapter.GetDataByComName(txtComName.Text.Trim());
                if (mTable.Rows.Count > 0)
                {
                    var mRow = (销售管理.DAL.DataSetCustomers.T_CustomersRow)mTable.Rows[0];
                    if (mId != mRow.id)
                    {
                        toolTip1.Show("该公司名称已存在!", txtComName, 0, txtComName.Height, 2000);
                        return;
                    }
                }

                int ret = adapter.UpdateById(txtComName.Text.Trim(), txtComAddr.Text.Trim(), txtBusinessName.Text.Trim(), txtBusinessTel.Text.Trim(), txtBusinessPhone.Text.Trim(), txtBusinessEmail.Text.Trim(), txtTechName.Text.Trim(), txtTechTel.Text.Trim(), txtTechPhone.Text.Trim(), txtTechEmail.Text.Trim(), txtDeliverName.Text.Trim(), txtDeliverAddr.Text.Trim(), txtDeliverPhone.Text.Trim(), (long)cmbCity.SelectedValue, mId);
                if (ret > 0)
                {
                    MessageBox.Show("修改成功");
                    btnSave.Enabled = false;
                    return;
                }
                else
                {
                    MessageBox.Show("修改失败");
                    return;
                }
            }
            else
            {
                T_CustomersTableAdapter adapter = new T_CustomersTableAdapter();
                var mTable = adapter.GetDataByComName(txtComName.Text.Trim());
                if (mTable.Rows.Count > 0)
                {
                    toolTip1.Show("该公司名称已存在!", txtComName, 0, txtComName.Height, 2000);
                    return;
                }
                else
                {
                    int ret = adapter.Insert(txtComName.Text.Trim(), txtComAddr.Text.Trim(), txtBusinessName.Text.Trim(), txtBusinessTel.Text.Trim(), txtBusinessPhone.Text.Trim(), txtBusinessEmail.Text.Trim(), txtTechName.Text.Trim(), txtTechTel.Text.Trim(), txtTechPhone.Text.Trim(), txtTechEmail.Text.Trim(), txtDeliverName.Text.Trim(), txtDeliverAddr.Text.Trim(), txtDeliverPhone.Text.Trim(), (long)cmbCity.SelectedValue, Classes.PubClass.UserId, "正常");
                    if (ret > 0)
                    {
                        MessageBox.Show("添加成功");
                        btnSave.Enabled = false;
                        return;
                    }
                    else
                    {
                        MessageBox.Show("添加失败");
                        return;
                    }
                }
            }
        }
コード例 #9
0
ファイル: 客户资料维护.cs プロジェクト: zymITsky/ss
        private void 客户资料维护_Load(object sender, EventArgs e)
        {
            //添加省市cmb
            var mTable1 = new T_PromaryTableAdapter().GetData();

            cmbPromary.DisplayMember = "proName";
            cmbPromary.ValueMember   = "proID";
            cmbPromary.DataSource    = mTable1;
            cmbPromary.SelectedIndex = -1;
            if (mId == -1)
            {
                btnSave.Text = "增加";
            }
            else
            {
                var mTable = new T_CustomersTableAdapter().GetDataById(mId);
                if (mTable.Rows.Count > 0)
                {
                    var mRow = (销售管理.DAL.DataSetCustomers.T_CustomersRow)mTable.Rows[0];
                    txtComName.Text      = mRow.CompanyName;
                    txtComAddr.Text      = mRow.CompanyAddress;
                    txtBusinessName.Text = mRow.BusinessContactName;
                    if (mRow.IsDeliverAddressNull() == false)
                    {
                        txtDeliverAddr.Text = mRow.DeliverAddress;
                    }
                    if (mRow.IsDeliverNameNull() == false)
                    {
                        txtDeliverName.Text = mRow.DeliverName;
                    }
                    if (mRow.IsDeliverPhoneNull() == false)
                    {
                        txtDeliverPhone.Text = mRow.DeliverPhone;
                    }
                    if (mRow.IsCityIDNull() == false)
                    {
                        var mTable2 = new T_CityTableAdapter().GetDataByID(mRow.CityID);
                        if (mTable2.Rows.Count > 0)
                        {
                            cmbPromary.SelectedValue = mTable2[0].proID;
                            cmbCity.SelectedValue    = mRow.CityID;
                        }
                    }
                    txtBusinessTel.Text   = mRow.BusinessContactTel;
                    txtBusinessPhone.Text = mRow.BusinessContactPhone;
                    txtBusinessEmail.Text = mRow.BusinessContactEmail;
                    txtTechName.Text      = mRow.TechContactName;
                    txtTechTel.Text       = mRow.TechContactTel;
                    txtTechPhone.Text     = mRow.TechContactPhone;
                    txtTechEmail.Text     = mRow.TechContactEmail;
                }
                else
                {
                    MessageBox.Show("获取客户资料错误");
                    this.Close();
                    return;
                }

                btnSave.Text = "保存";
            }
        }