Exemplo n.º 1
0
 private void toolDel_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (DBGrid.CurrentRow == null)
         {
             return;
         }
         if (MessageBox.Show(clsTranslate.TranslateString("Do you really want to delete it?"), clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             return;
         }
         modCustomerOrderList mod = _dal.GetItem(Convert.ToInt32(DBGrid.CurrentRow.Cells[0].Value), out Util.emsg);
         bool ret = _dal.Delete(mod.Id, out Util.emsg);
         if (ret)
         {
             LoadData();
         }
         else
         {
             MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Exemplo n.º 2
0
        public void ImportOrder(int id)
        {
            dalCustomerOrderList dal = new dalCustomerOrderList();
            modCustomerOrderList mod = dal.GetItem(id, out Util.emsg);

            if (mod != null)
            {
                _action               = "NEW";
                txtId.Text            = "0";
                dtpFormDate.Value     = DateTime.Today;
                dtpRequireDate.Value  = mod.RequireDate;
                txtVendorOrderNo.Text = mod.CustOrderNo;
                txtCurrency.Text      = mod.Currency;
                //txtVendorName.Text = mod.VendorName;
                txtPayMethod.Text   = mod.PayMethod;
                txtPurchaseMan.Text = Util.UserId;
                txtUnitNo.Text      = mod.UnitNo;
                txtQty.Text         = mod.Qty.ToString();
                //txtPrice.Text = mod.Price.ToString();
                txtProductName.Tag  = mod.ProductId;
                txtProductName.Text = mod.ProductName;
                txtSize.Text        = mod.Size.ToString();
                txtRemark.Text      = mod.Remark;
            }
        }
Exemplo n.º 3
0
 public void EditItem(int id)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         _action     = "EDIT";
         modCustomerOrderList mod = _dal.GetItem(id, out Util.emsg);
         if (mod != null)
         {
             txtId.Text           = id.ToString();
             dtpFormDate.Value    = mod.FormDate;
             dtpRequireDate.Value = mod.RequireDate;
             txtCustOrderNo.Text  = mod.CustOrderNo;
             txtCurrency.Text     = mod.Currency;
             txtCustName.Tag      = mod.CustId;
             txtCustName.Text     = mod.CustName;
             txtPayMethod.Text    = mod.PayMethod;
             txtSalesMan.Text     = mod.SalesMan;
             txtUnitNo.Text       = mod.UnitNo;
             txtQty.Text          = mod.Qty.ToString();
             txtPrice.Text        = mod.Price.ToString();
             txtProductName.Tag   = mod.ProductId;
             txtProductName.Text  = mod.ProductName;
             txtSize.Text         = mod.Size.ToString();
             txtRemark.Text       = mod.Remark;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Exemplo n.º 4
0
        public void Import(int id)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                _action     = "NEW";
                FillControl.FillDesignType(cboDesignType, false);
                FillControl.FillReceiveStatus(cboReceiveStatus, false);
                FillControl.FillInvoiceStatus(cboInvoiceStatus, false);
                dalCustomerOrderList dal = new dalCustomerOrderList();
                modCustomerOrderList mod = dal.GetItem(id, out Util.emsg);
                if (mod != null)
                {
                    txtId.Text        = "0";
                    dtpFormDate.Value = DateTime.Today;
                    //cboDesignType.SelectedValue = mod.FormType;
                    txtCustOrderNo.Text = mod.CustOrderNo;
                    txtNo.Text          = _dal.GetNewNo(dtpFormDate.Value, mod.CustId);
                    txtCurrency.Text    = mod.Currency;
                    txtCustName.Tag     = mod.CustId;
                    txtCustName.Text    = mod.CustName;
                    txtPayMethod.Text   = mod.PayMethod;
                    txtSalesMan.Text    = mod.SalesMan;
                    txtUnitNo.Text      = mod.UnitNo;
                    txtQty.Text         = mod.Qty.ToString();
                    txtMny.Text         = (mod.Qty * mod.Price).ToString();
                    txtSalesManMny.Text = "0";
                    txtProductName.Text = mod.ProductName;
                    txtRemark.Text      = mod.Remark;
                    txtInvoiceMny.Text  = "0";
                    dalCustomerList dalcust = new DAL.dalCustomerList();
                    modCustomerList modcust = dalcust.GetItem(mod.CustId, out Util.emsg);
                    if (modcust != null)
                    {
                        //txtCustName.Tag = modcust.CustId;
                        //txtCustName.Text = modcust.CustName;
                        //txtPayMethod.Text = modcust.txtPayMethod;
                        //txtSalesMan.Text = modcust.SalesMan;
                        //txtCurrency.Text = mod.Currency;
                        if (modcust.NeedInvoice == 1)
                        {
                            cboReceiveStatus.SelectedIndex = 0;
                            cboInvoiceStatus.SelectedIndex = 1;
                        }
                        else
                        {
                            cboReceiveStatus.SelectedIndex = 1;
                            cboInvoiceStatus.SelectedIndex = 0;
                        }
                    }

                    status4.Image    = null;
                    toolSave.Visible = true;
                    Util.ChangeStatus(this, false);
                    txtId.ReadOnly   = true;
                    toolSave.Enabled = true;

                    cboReceiveStatus.Enabled = true;
                    cboInvoiceStatus.Enabled = true;
                    cboAccountNo.Enabled     = true;
                    txtInvoiceMny.ReadOnly   = false;
                    txtInvoiceNo.ReadOnly    = false;
                    btnUpdate.Enabled        = true;
                    btnReceiveDate.Enabled   = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }