示例#1
0
 private void btn_del_Click(object sender, EventArgs e)
 {
     if (dgvCustomer.CurrentRow == null || dgvCustomer.CurrentRow.Index == -1)
     {
         new PubUtils().ShowNoteNGMsg("请选中行", 2, grade.OrdinaryError);
         return;
     }
     if (Bll_SysdatMPNCustomer.Delete(string.Format(" where CustomerID='{0}'", dgvCustomer.CurrentRow.Cells["CustomerID"].Value.ToString())))
     {
         QueryData();
         new PubUtils().ShowNoteOKMsg("删除成功");
     }
 }
示例#2
0
        private void QueryData()
        {
            string strWhere = "where 1= 1";

            if (!string.IsNullOrEmpty(txt_CustomerCode.Text.Trim()))
            {
                strWhere += string.Format(" and CustomerCode='{0}'", txt_CustomerCode.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txt_customerName.Text.Trim()))
            {
                strWhere += string.Format(" and  CustomerName='{0}'", txt_customerName.Text.Trim());
            }
            dtCustomer             = Bll_SysdatMPNCustomer.Query(strWhere);
            dgvCustomer.DataSource = dtCustomer;
        }
示例#3
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            string varMsg = string.Empty;

            if (!CheckData(out varMsg))
            {
                new PubUtils().ShowNoteNGMsg(varMsg, 2, grade.OrdinaryError);
                return;
            }
            obj.CustomerName    = txt_customerName.Text.Trim();
            obj.CustomerCode    = txt_customerCode.Text.Trim();
            obj.Contact         = txt_contract.Text.Trim();
            obj.ContactNumber   = txt_contractNum.Text.Trim();
            obj.Email           = txt_email.Text.Trim();
            obj.ShippingAddress = txt_address.Text.Trim();
            if (opetrationType == OperationType.Add)
            {
                obj.CustomerID = Guid.NewGuid().ToString();
                obj.Creator    = PubUtils.uContext.UserName;
                obj.CreateTime = DateTime.Now;
                if (Bll_SysdatMPNCustomer.Insert(obj))
                {
                    this.DialogResult = DialogResult.OK;
                    obj = new SysdatMPNCustomer();
                    this.Close();
                }
                else
                {
                    new PubUtils().ShowNoteNGMsg("添加失败", 2, grade.OrdinaryError);
                    return;
                }
            }
            else if (opetrationType == OperationType.Edit)
            {
                if (Bll_SysdatMPNCustomer.Update(obj))
                {
                    this.DialogResult = DialogResult.OK;
                    obj = new SysdatMPNCustomer();
                    this.Close();
                }
                else
                {
                    new PubUtils().ShowNoteNGMsg("修改失败", 2, grade.OrdinaryError);
                    return;
                }
            }
        }