Ejemplo n.º 1
0
 private void GetSupplierDetails(int SupplierID, int companyID, bool isProperties)
 {
     try
     {
         _currentSupplier = new SupplierDL(SupplierID, companyID, isProperties);
         AssignValues();
     }
     catch (Exception exception1)
     {
         ErrorLog.LogErrorMessageToDB("AddEditSupplier.aspx", "", "GetSupplierDetails", exception1.Message.ToString(), new ACEConnection());
         throw;
     }
 }
Ejemplo n.º 2
0
        private void GetSupplierDetails(int SupplierID, int companyID, string searchText)
        {
            try
            {
                SupplierDL Supplier = new SupplierDL();
                //    DataView dataView = Supplier.GetSupplierDetails(SupplierID, companyID, searchText).Tables[0].DefaultView;
                //    dataView.Sort = string.Concat(base.ViewState["SortExpression"].ToString(), " ", base.ViewState["SortDirection"].ToString());

                DataTable ds = Supplier.GetSupplierDetails(SupplierID, companyID, searchText).Tables[0];
                if (ds.Rows.Count == 0)
                {
                    ds.Rows.Add(ds.NewRow());
                    gvSupplierDetails.DataSource = ds;
                    gvSupplierDetails.DataBind();
                    int columncount = gvSupplierDetails.Rows[0].Cells.Count;
                    gvSupplierDetails.Rows[0].Cells.Clear();
                    gvSupplierDetails.Rows[0].Cells.Add(new TableCell());
                    gvSupplierDetails.Rows[0].Cells[0].ColumnSpan = columncount;
                    gvSupplierDetails.Rows[0].Cells[0].Attributes.CssStyle.Add("text-align", "Center");
                    gvSupplierDetails.Rows[0].Cells[0].Attributes.CssStyle.Add("font-weight", "bold");
                    gvSupplierDetails.Rows[0].Cells[0].Text = "Currently there are no entries to display";
                }
                else
                {
                    gvSupplierDetails.DataSource = ds;
                    gvSupplierDetails.DataBind();
                }

                //gvSupplierDetails.DataSource = dataView;
                //gvSupplierDetails.DataBind();
            }
            catch (Exception exception1)
            {
                ErrorLog.LogErrorMessageToDB("ManageSuppliers.aspx", "", "GetSupplierDetails(int SupplierID, string searchText)", exception1.Message.ToString(), new ACEConnection());
                throw;
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Hàm khởi tạo mặc định
 /// </summary>
 /// Người tạo: ntxuan (20/6/2019)
 public SupplierBL()
 {
     supplierDL = new SupplierDL();
 }
Ejemplo n.º 4
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                _currentSupplier = new SupplierDL();
                bool bl = false;
                if (txtSupplierID.Text.ToString() == "0")
                {
                    _currentSupplier.AddEditOption = 0;
                }
                else
                {
                    _currentSupplier.AddEditOption = 1;
                }
                _currentSupplier.SupplierID          = Convert.ToInt32(txtSupplierID.Text);
                _currentSupplier.CompanyID           = Convert.ToInt32(hfCompanyID.Value);
                _currentSupplier.SupplierCompanyName = txtSupplierCompanyName.Text;
                _currentSupplier.SupplierName        = txtSupplierName.Text;
                _currentSupplier.SalesPersonName     = txtSalesPersonName.Text;
                _currentSupplier.TinNo = txtTinNo.Text;
                _currentSupplier.CcrNo = txtCCRNo.Text;
                _currentSupplier.SupplierAddress.Address1 = txtAddress.Text;
                _currentSupplier.SupplierAddress.Address2 = txtAddress2.Text;
                _currentSupplier.SupplierAddress.Address3 = txtAddress3.Text;
                bl = (!(ddlCountry.SelectedValue.ToString() != "")) || (!(ddlCountry.SelectedValue.ToString() != "0")) ? true : ddlCountry.SelectedValue.ToString() == null;
                if (!bl)
                {
                    _currentSupplier.SupplierAddress.CountryID = Convert.ToInt32(ddlCountry.SelectedValue);
                }
                bl = (!(ddlState.SelectedValue.ToString() != "")) || (!(ddlState.SelectedValue.ToString() != "0")) ? true : ddlState.SelectedValue.ToString() == null;
                if (!bl)
                {
                    _currentSupplier.SupplierAddress.StateID = Convert.ToInt32(ddlState.SelectedValue);
                }
                bl = (!(ddlCity.SelectedValue.ToString() != "")) || (!(ddlCity.SelectedValue.ToString() != "0")) ? true : ddlCity.SelectedValue.ToString() == null;
                if (!bl)
                {
                    _currentSupplier.SupplierAddress.CityID = Convert.ToInt32(ddlCity.SelectedValue);
                }
                _currentSupplier.SupplierAddress.PostalCode = txtZipCode.Text;
                _currentSupplier.HomeEmail   = txtEmailID.Text;
                _currentSupplier.WorkEmail   = txtSecondEmailID.Text;
                _currentSupplier.HomePhone   = txtHomePhone.Text;
                _currentSupplier.WorkPhone   = txtWorkPhone.Text;
                _currentSupplier.MobilePhone = txtMobilePhone.Text;

                bl = (!(ddlBank.SelectedValue.ToString() != "")) || (!(ddlBank.SelectedValue.ToString() != "0")) ? true : ddlBank.SelectedValue.ToString() == null;
                if (!bl)
                {
                    _currentSupplier.BankId = Convert.ToInt32(ddlBank.SelectedValue);
                }

                _currentSupplier.BankRegion        = txtBankRegion.Text;
                _currentSupplier.BankAccountNumber = txtBankAccountNumber.Text;
                _currentSupplier.BankBranch        = txtBankBranch.Text;
                _currentSupplier.BankBranchCode    = txtBankCode.Text;
                _currentSupplier.BankIfsc          = txtIFSCCode.Text;

                _currentSupplier.BankBranchAddress = txtBranchAddress.Text;


                bl = (!(ddlAgentName.SelectedValue.ToString() != "")) || (!(ddlAgentName.SelectedValue.ToString() != "0")) ? true : ddlAgentName.SelectedValue.ToString() == null;
                if (!bl)
                {
                    _currentSupplier.AgentId = Convert.ToInt32(ddlAgentName.SelectedValue);
                }

                _currentSupplier.Comments            = txtComments.Text;
                _currentSupplier.PreferredSupplierId = ThaiRating.CurrentRating.ToString();
                _currentSupplier.ScreenMode          = ScreenMode.Add;
                TransactionResult transactionResult;
                transactionResult = _currentSupplier.Commit();
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(string.Concat("<script>alert(\'", transactionResult.Message.ToString(), ".\');"));
                stringBuilder.Append("</script>");
                ScriptManager.RegisterStartupScript(base.Page, typeof(string), "MyScript", stringBuilder.ToString(), false);

                if (transactionResult.Status == TransactionStatus.Success)
                {
                    GetSupplierDetails(_currentSupplier.SupplierID, Convert.ToInt32(hfCompanyID.Value), true);
                }
            }
            catch (Exception exception1)
            {
                ErrorLog.LogErrorMessageToDB("AddEditSupplier.aspx", "", "btnSave_Click", exception1.Message.ToString(), new ACEConnection());
                throw;
            }
        }
Ejemplo n.º 5
0
 public SupplierBL(string connectionString)
 {
     supplierDL = new SupplierDL(connectionString);
 }