Esempio n. 1
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (CheckUserInput())
     {
         Express.Model.CustomerInfo model = new Express.Model.CustomerInfo();
         model.Address        = txtAddress.Text;
         model.contactperson  = txtContractUser.Text;
         model.contactphone   = txtContractTel.Text;
         model.CState         = cbCstate.SelectedIndex;
         model.cusname        = txtCusName.Text;
         model.departmentname = txtOrgName.Text;
         model.OperUser3      = ClientInfo.Sys_UserInfo.username;
         model.Remark         = txtRemark.Text;
         model.UserDate3      = DateTime.Now;
         string msg = "";
         if (null == btnOK.Tag)
         {
             bool isSuc = new Express.BLL.CustomerInfo().Add(model);
             msg = isSuc ? "添加客户信息成功!" : "添加客户信息失败!";
         }
         else
         {
             model.cid = Convert.ToInt32(btnOK.Tag);
             bool isSuc = new Express.BLL.CustomerInfo().Update(model);
             msg = isSuc ? "修改客户信息成功!" : "修改客户信息失败!";
         }
         MessageBox.Show(msg, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 初始化数据信息
        /// </summary>
        private void InitialData()
        {
            List <Express.Model.CustomerInfo> infos = new Express.BLL.CustomerInfo().GetModelList("");
            TreeNode pnode = new TreeNode();

            pnode.Text       = ClientInfo.SysSetInfo.cusname;
            pnode.Tag        = 0;
            pnode.ImageIndex = 0;
            for (int i = 0; i < infos.Count; i++)
            {
                TreeNode cnode = new TreeNode();
                cnode.Text       = infos[i].cusname;
                cnode.ImageIndex = 1;
                cnode.Tag        = infos[i].cid;
                pnode.Nodes.Add(cnode);
            }

            tvCustomer.Nodes.Add(pnode);
            List <Express.Model.Sys_User> users = new Express.BLL.Sys_User().GetModelList(" UState=0 and issaleman=true");

            users.Insert(0, new Express.Model.Sys_User()
            {
                UID = 0, PerName = "==请选择=="
            });
            this.ddlSaleMan.DisplayMember = "PerName";
            this.ddlSaleMan.ValueMember   = "UID";
            this.ddlSaleMan.DataSource    = users;
            cbOrderState.SelectedIndex    = 0;
            cbCatchState.SelectedIndex    = 0;
        }
Esempio n. 3
0
 /// <summary>
 /// 修改信息
 /// </summary>
 /// <param name="id"></param>
 public CusEditForm(int id)
 {
     InitializeComponent();
     cbCstate.SelectedIndex = 0;
     new Provider().AddKeyEnterEvent(this);
     this.Text = "修改客户信息";
     btnOK.Tag = id;
     Express.Model.CustomerInfo info = new Express.BLL.CustomerInfo().GetModel(id);
     if (null == info)
     {
         MessageBox.Show("该客户信息已经不存在!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     else
     {
         txtAddress.Text        = info.Address;
         txtContractTel.Text    = info.contactphone;
         txtContractUser.Text   = info.contactperson;
         txtCusName.Text        = info.cusname;
         txtOrgName.Text        = info.departmentname;
         txtRemark.Text         = info.Remark;
         cbCstate.SelectedIndex = info.CState.Value;
         btnCancel.Tag          = txtCusName.Text;//保存原始的客户简称
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 初始化界面信息
        /// </summary>
        private void InitialView()
        {
            DataSet   dsInfo = new Express.BLL.CustomerInfo().GetListByPage(SearchCondition, "cid", anpageinfo.PageSize, anpageinfo.PageIndex);
            DataTable dt     = dsInfo.Tables[0];

            gvInfo.Rows.Clear();
            int rowCount = dt.Rows.Count;

            if (rowCount > 0)
            {
                gvInfo.Rows.Add(rowCount);
            }
            rowCount = 0;
            foreach (DataRow item in dt.Rows)
            {
                gvInfo.Rows[rowCount].Cells[0].Value = item["cid"];
                gvInfo.Rows[rowCount].Cells[1].Value = (rowCount + 1);
                gvInfo.Rows[rowCount].Cells[2].Value = item["cusname"];
                gvInfo.Rows[rowCount].Cells[3].Value = item["departmentname"];
                gvInfo.Rows[rowCount].Cells[4].Value = ConvertState(Convert.ToInt32(item["CState"]));
                gvInfo.Rows[rowCount].Cells[5].Value = item["contactphone"];
                gvInfo.Rows[rowCount].Cells[6].Value = item["contactperson"];
                gvInfo.Rows[rowCount].Cells[7].Value = item["Address"];
                gvInfo.Rows[rowCount].Cells[8].Value = item["UserDate3"];
                gvInfo.Rows[rowCount].Cells[9].Value = item["OperUser3"];
                rowCount++;
            }
        }
Esempio n. 5
0
        private void InitialData()
        {
            List <Express.Model.CustomerInfo> infos = new Express.BLL.CustomerInfo().GetModelList("");

            this.ddlCustomer.DisplayMember = "cusname";
            this.ddlCustomer.ValueMember   = "cid";
            this.ddlCustomer.DataSource    = infos;
        }
Esempio n. 6
0
        /// <summary>
        /// 初始化数据信息
        /// </summary>
        private void InitialData()
        {
            int recordCount = new Express.BLL.CustomerInfo().GetRecordCount(SearchCondition);

            anpageinfo.RecordCount = recordCount;

            InitialView();
        }
Esempio n. 7
0
        private void InitialData()
        {
            List <Express.Model.CustomerInfo> infos = new Express.BLL.CustomerInfo().GetModelList("");
            CustomerInfo first = new CustomerInfo();

            first.cusname = "==请选择==";
            first.cid     = 0;
            infos.Insert(0, first);
            this.ddlCustomer.DisplayMember = "cusname";
            this.ddlCustomer.ValueMember   = "cid";
            this.ddlCustomer.DataSource    = infos;
        }
Esempio n. 8
0
        /// <summary>
        /// 初始化数据信息
        /// </summary>
        private void InitialData()
        {
            List <Express.Model.CustomerInfo> infos = new Express.BLL.CustomerInfo().GetModelList("");

            this.ddlCustomer.DisplayMember = "cusname";
            this.ddlCustomer.ValueMember   = "cid";
            this.ddlCustomer.DataSource    = infos;
            List <Express.Model.Sys_User> users = new Express.BLL.Sys_User().GetModelList(" UState=0 and issaleman=true");

            this.ddlSaleMan.DisplayMember = "PerName";
            this.ddlSaleMan.ValueMember   = "UID";
            this.ddlSaleMan.DataSource    = users;
        }
Esempio n. 9
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (CheckSelectedOne())
     {
         if (MessageBox.Show("确认要删除选中的数据吗?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
         {
             if (new Express.BLL.OrderInfo().GetRecordCount(" CustomerID in (" + SelectedIds + ")") > 0)
             {
                 MessageBox.Show("选择的客户信息已经使用,请先删除子信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             bool   sucess = new Express.BLL.CustomerInfo().DeleteList(SelectedIds);
             string msg    = sucess ? "删除客户信息成功!" : "删除客户信息失败!";
             MessageBox.Show(msg, " 系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             InitialData();
         }
     }
 }