예제 #1
0
 private void txtDeliveryCode_Leave(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtCustomerCode.Text) && !string.IsNullOrEmpty(txtDeliveryCode.Text))
     {
         BaseDeliveryTable DeliveryCode = new BaseDeliveryTable();
         DeliveryCode = bDelivery.GetModel(txtCustomerCode.Text.Trim(), txtDeliveryCode.Text.Trim());
         if (DeliveryCode != null)
         {
             txtCustomerCode.Text = "";
             txtCustomerName.Text = "";
             txtDeliveryCode.Text = "";
             txtAddressFirst.Text = "";
             txtCustomerCode.Focus();
             MessageBox.Show("客户编号和地址编号的组合已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
예제 #2
0
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                string customercode = dgvData.SelectedRows[0].Cells["CUSTOMER_CODE"].Value.ToString();
                string deliverycode = dgvData.SelectedRows[0].Cells["DELIVERY_CODE"].Value.ToString();
                if (customercode != "")
                {
                    _currentDeliveryTable = bDelivery.GetModel(customercode, deliverycode);
                }
            }
            catch (Exception ex) { }

            if (_currentDeliveryTable == null || _currentDeliveryTable.CUSTOMER_CODE == null || "".Equals(_currentDeliveryTable.CUSTOMER_CODE))
            {
                _currentDeliveryTable = null;
            }
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                if (_currentDeliveryTable == null)
                {
                    _currentDeliveryTable = new BaseDeliveryTable();
                }

                _currentDeliveryTable.CUSTOMER_CODE = txtCustomerCode.Text.Trim();
                //_currentDeliveryTable.CUSTOMER_NAME = txtCustomerName.Text.Trim();
                _currentDeliveryTable.DELIVERY_CODE    = txtDeliveryCode.Text.Trim();
                _currentDeliveryTable.ADDRESS_FIRST    = txtAddressFirst.Text.Trim();
                _currentDeliveryTable.ADDRESS_MIDDLE   = txtAddressMiddle.Text.Trim();
                _currentDeliveryTable.ADDRESS_LAST     = txtAddressLast.Text.Trim();
                _currentDeliveryTable.ZIP_CODE         = txtZipCode.Text.Trim();
                _currentDeliveryTable.PHONE_NUMBER     = txtPhone.Text.Trim();
                _currentDeliveryTable.FAX_NUMBER       = txtFax.Text.Trim();
                _currentDeliveryTable.MOBIL_NUMBER     = txtMobilNumber.Text.Trim();
                _currentDeliveryTable.CONTACT_NAME     = txtContactName.Text.Trim();
                _currentDeliveryTable.LAST_UPDATE_USER = _userInfo.CODE;

                try
                {
                    if (bDelivery.Exists(txtCustomerCode.Text.Trim(), txtDeliveryCode.Text.Trim()))
                    {
                        bDelivery.Update(_currentDeliveryTable);
                    }
                    else
                    {
                        _currentDeliveryTable.CREATE_USER = _userInfo.CODE;
                        bDelivery.Add(_currentDeliveryTable);
                    }
                }
                catch (Exception ex)
                {
                    //log.error
                    MessageBox.Show("");
                    return;
                }
                result = DialogResult.OK;
                this.Close();
            }
        }
예제 #4
0
 /// <summary>
 /// 打开新窗口
 /// </summary>
 private void OpenDialogFrm(int mode)
 {
     if (mode == CConstant.MODE_NEW || _currentDeliveryTable != null)
     {
         FrmDeliveryDialog frm = new FrmDeliveryDialog();
         frm.UserInfo             = _userInfo;
         frm.CurrentDeliveryTable = _currentDeliveryTable;
         frm.Mode = mode;
         DialogResult resule = frm.ShowDialog(this);
         if (resule == DialogResult.OK && isSearch)
         {
             Search(this.pgControl.GetCurrentPage());
         }
         frm.Dispose();
     }
     else
     {
         //MessageBox.Show("请选择正确的行!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     _currentDeliveryTable = null;
 }
예제 #5
0
 /// <summary>
 /// 删除
 /// </summary>
 private void MasterToolBar_DoDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要删除吗?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.OK)
     {
         try
         {
             GetCurrentSelectedTable();
             if (_currentDeliveryTable != null)
             {
                 bDelivery.Delete(_currentDeliveryTable.CUSTOMER_CODE, _currentDeliveryTable.DELIVERY_CODE);
                 Search(this.pgControl.GetCurrentPage());
             }
             else
             {
                 MessageBox.Show("请选择正确的行!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("删除失败,请重试或与系统管理员联系。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         _currentDeliveryTable = null;
     }
 }
예제 #6
0
        public override string[] doUpdateDB()
        {
            BaseDeliveryTable DeliveryTable = null;
            BDelivery         bDelivery     = new BDelivery();
            StringBuilder     strError      = new StringBuilder();
            int    successData    = 0;
            int    failureData    = 0;
            string errorFilePath  = "";
            string backupFilePath = "";

            //数据导入处理
            foreach (DataRow dr in _csvDataTable.Rows)
            {
                StringBuilder str = new StringBuilder();
                //客户编号
                str.Append(CheckCustomer(CConvert.ToString(GetValue(dr, "CUSTOMER_CODE")), "客户编号"));
                //地址编号
                if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "DELIVERY_CODE"))))
                {
                    str.Append(CheckString(GetValue(dr, "DELIVERY_CODE"), 20, "地址编号"));
                }
                else
                {
                    str.Append("地址编号不能为空!");
                }
                //邮编
                str.Append(CheckLenght(GetValue(dr, "ZIP_CODE"), 8, "邮编"));
                //地址1
                str.Append(CheckLenght(GetValue(dr, "ADDRESS_FIRST"), 100, "地址1"));
                //地址2
                str.Append(CheckLenght(GetValue(dr, "ADDRESS_MIDDLE"), 100, "地址2"));
                //地址3
                str.Append(CheckLenght(GetValue(dr, "ADDRESS_LAST"), 100, "地址3"));
                //电话
                str.Append(CheckLenght(GetValue(dr, "PHONE_NUMBER"), 20, "电话"));
                //传真
                str.Append(CheckLenght(GetValue(dr, "FAX_NUMBER"), 20, "传真"));
                //联系人名称
                str.Append(CheckLenght(GetValue(dr, "CONTACT_NAME"), 50, "联系人名称"));
                //联系人电话
                str.Append(CheckLenght(GetValue(dr, "MOBIL_NUMBER"), 20, "联系人电话"));
                //状态
                str.Append(CheckInt(GetValue(dr, "STATUS_FLAG", 1), 9, "状态"));

                if (str.ToString().Trim().Length > 0)
                {
                    strError.Append(GetStringBuilder(dr, str.ToString().Trim()));
                    failureData++;
                    continue;
                }
                try
                {
                    DeliveryTable = new BaseDeliveryTable();
                    DeliveryTable.CUSTOMER_CODE    = CConvert.ToString(GetValue(dr, "CUSTOMER_CODE"));
                    DeliveryTable.DELIVERY_CODE    = CConvert.ToString(GetValue(dr, "DELIVERY_CODE"));
                    DeliveryTable.ZIP_CODE         = CConvert.ToString(GetValue(dr, "ZIP_CODE"));
                    DeliveryTable.ADDRESS_FIRST    = CConvert.ToString(GetValue(dr, "ADDRESS_FIRST"));
                    DeliveryTable.ADDRESS_MIDDLE   = CConvert.ToString(GetValue(dr, "ADDRESS_MIDDLE"));
                    DeliveryTable.ADDRESS_LAST     = CConvert.ToString(GetValue(dr, "ADDRESS_LAST"));
                    DeliveryTable.PHONE_NUMBER     = CConvert.ToString(GetValue(dr, "PHONE_NUMBER"));
                    DeliveryTable.FAX_NUMBER       = CConvert.ToString(GetValue(dr, "FAX_NUMBER"));
                    DeliveryTable.CONTACT_NAME     = CConvert.ToString(GetValue(dr, "CONTACT_NAME"));
                    DeliveryTable.MOBIL_NUMBER     = CConvert.ToString(GetValue(dr, "MOBIL_NUMBER"));
                    DeliveryTable.STATUS_FLAG      = CConvert.ToInt32(GetValue(dr, "STATUS_FLAG", CConstant.NORMAL_STATUS));
                    DeliveryTable.CREATE_USER      = _userInfo.CODE;
                    DeliveryTable.LAST_UPDATE_USER = _userInfo.CODE;

                    if (!bDelivery.Exists(DeliveryTable.CUSTOMER_CODE, DeliveryTable.DELIVERY_CODE))
                    {
                        bDelivery.Add(DeliveryTable);
                    }
                    else
                    {
                        bDelivery.Update(DeliveryTable);
                    }
                    successData++;
                }
                catch
                {
                    strError.Append(GetStringBuilder(dr, " 数据导入失败,请与系统管理员联系!").ToString());
                    failureData++;
                }
            }
            //错误记录处理
            if (strError.Length > 0)
            {
                errorFilePath = WriteFile(strError.ToString());
            }

            //备份处理
            backupFilePath = BackupFile();

            return(new string[] { successData.ToString(), failureData.ToString(), errorFilePath, backupFilePath });
        }
예제 #7
0
파일: BDelivery.cs 프로젝트: zhr008/ERP-1
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BaseDeliveryTable model)
 {
     return(dal.Update(model));
 }
예제 #8
0
파일: BDelivery.cs 프로젝트: zhr008/ERP-1
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(BaseDeliveryTable model)
 {
     return(dal.Add(model));
 }