public ActionResult GetSupplier()
        {
            var suppliers  = new List <SupplierDetails>();
            var supplierId = _unit.ChemicalLocalPurchaseBillRepository.Get().Select(ob => ob.SupplierID).Distinct().ToList();

            foreach (var i in supplierId)
            {
                var supplier = new SupplierDetails();
                var suppInfo = _unit.SysSupplierRepository.GetByID(i);
                var suppAdd  = _unit.SupplierAddressRepository.Get().FirstOrDefault(ob => ob.SupplierID == 1 && ob.IsActive);
                supplier.SupplierID   = suppInfo.SupplierID;
                supplier.SupplierCode = suppInfo.SupplierCode;
                supplier.SupplierName = suppInfo.SupplierName;
                if (suppAdd != null)
                {
                    supplier.SupplierAddressID = suppAdd.SupplierAddressID.ToString();
                }
                if (suppAdd != null)
                {
                    supplier.Address = suppAdd.Address;
                }
                if (suppAdd != null)
                {
                    supplier.ContactNumber = suppAdd.ContactNumber;
                }
                if (suppAdd != null)
                {
                    supplier.ContactPerson = suppAdd.ContactPerson;
                }
                suppliers.Add(supplier);
            }
            return(Json(suppliers, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        private void OnClick(object sender, EventArgs e)
        {
            Blur blur = new Blur(this.ParentForm, UIConstants.FormBlurOpacity);

            blur.Show();

            SupplierDetails supplierDetails = new SupplierDetails
            {
                Supplier = Supplier,
                Task     = Enums.Task.Get,
                TopMost  = true
            };

            //Update If Updated
            var formResponse = supplierDetails.ShowWithResponse();

            if (formResponse.ActionDialog == Enums.ActionDialog.Updated)
            {
                Supplier = (Backend.Objects.ProductSupplier)formResponse.Data;

                //Force Update
                this.Initialize();
            }
            else if (formResponse.ActionDialog == Enums.ActionDialog.Deleted)
            {
                // Delete -> Nothing to show
                this.OnDelete(this, e);
                this.Hide();
            }

            blur.Close();
        }
Esempio n. 3
0
 private void button13_Click(object sender, EventArgs e)
 {
     if (ledgerId > 0)
     {
         SupplierDetails ss = new SupplierDetails();
         ss.dataGridBind();
     }
     this.Close();
 }
 public static Supplier ToDomain(this SupplierDetails model)
 {
     return(model is null
         ? null
         : new Supplier
     {
         Id = model.SupplierId,
         Name = model.Name,
         Address = model.AddressFromJson.ToDomain(),
     });
 }
Esempio n. 5
0
 //public bool DeleteSupplier(int Supplierid,int Userid)
 //{
 //    bool IsDelete = false;
 //    try
 //    {
 //        IsDelete = objDAL.DeleteSupplier(Supplierid, Userid);
 //        return IsDelete;
 //    }
 //    catch (Exception )
 //    {
 //        throw;
 //    }
 //}
 #endregion
 #region UpdateSupplierDetails
 public int UpdateSupplierDetails(SupplierDetails objSupplierDetails)
 {
     try
     {
         return(objDAL.UpdateSupplierDetails(objSupplierDetails));
     }
     catch (Exception)
     {
         throw;
     }
 }
        public OrderBuilder WithNewSupplier(SupplierDetails supplierDetails)
        {
            order.Supplier = new Supplier
            {
                Id      = supplierDetails.SupplierId,
                Address = supplierDetails.AddressFromJson.ToDomain(),
                Name    = supplierDetails.Name,
            };

            return(this);
        }
Esempio n. 7
0
        private void LoadSupplierList()
        {
            List <SupplierDetails> lstsupp = bls.GetAllSupplier();

            SupplierDetails supp = new SupplierDetails();

            supp.S_Name = "Choose Supplier";
            lstsupp.Insert(0, supp);

            cboSupplierName.DataSource    = lstsupp;
            cboSupplierName.DisplayMember = "S_Name";
            cboSupplierName.ValueMember   = "S_ID";
        }
Esempio n. 8
0
        public int UpdateSupplier(SupplierDetails sd)
        {
            tblSupplier ts = _db.tblSuppliers.Where(s => s.S_ID == sd.S_ID).FirstOrDefault();

            ts.S_ID       = sd.S_ID;
            ts.SupplierNo = sd.SupplierNo;
            ts.S_Name     = sd.S_Name;
            ts.Address    = sd.Address;
            ts.City       = sd.City;
            ts.Email      = sd.Email;
            ts.ContactNo  = sd.ContactNo;
            ts.Photo      = sd.Photo;
            return(_db.SaveChanges());
        }
Esempio n. 9
0
        public int AddNewSupplier(SupplierDetails sd)
        {
            tblSupplier ts = new tblSupplier();

            ts.SupplierNo = sd.SupplierNo;
            ts.S_Name     = sd.S_Name;
            ts.Address    = sd.Address;
            ts.City       = sd.City;
            ts.Email      = sd.Email;
            ts.ContactNo  = sd.ContactNo;
            ts.Photo      = sd.Photo;
            _db.tblSuppliers.Add(ts);
            return(_db.SaveChanges());
        }
Esempio n. 10
0
        public SupplierDetails SetToBussinessObject(Sys_Supplier Entity)
        {
            SupplierDetails Model = new SupplierDetails();

            Model.SupplierID   = Entity.SupplierID;
            Model.SupplierCode = Entity.SupplierCode;
            if (_context.Sys_SupplierAddress.Where(q => q.SupplierID == Entity.SupplierID && q.IsActive.Equals(true) && q.IsDelete.Equals(false)).FirstOrDefault() != null)
            {
                Model.SupplierAddressID = _context.Sys_SupplierAddress.Where(q => q.SupplierID == Entity.SupplierID && q.IsActive.Equals(true) && q.IsDelete.Equals(false)).FirstOrDefault().SupplierAddressID.ToString();
                Model.Address           = _context.Sys_SupplierAddress.Where(q => q.SupplierID == Entity.SupplierID && q.IsActive.Equals(true) && q.IsDelete.Equals(false)).FirstOrDefault().Address;
            }
            Model.SupplierName = Entity.SupplierName;

            return(Model);
        }
Esempio n. 11
0
        private void button9_Click(object sender, EventArgs e)
        {
            MainWindow.Controls.Clear();
            label1.Text      = "Supplier Details";
            SidePanel.Height = button9.Height;
            SidePanel.Top    = button9.Top;


            SupplierDetails ss = new SupplierDetails();

            ss.Dock = DockStyle.Fill;
            MainWindow.Controls.Add(ss);
            ss.Show();

            entriesButtonHide();
        }
        private SupplierDetails SetToSupplierModel(Sys_Supplier entity)
        {
            var model = new SupplierDetails();

            model.SupplierID   = entity.SupplierID;
            model.SupplierCode = entity.SupplierCode;
            model.SupplierName = entity.SupplierName;
            var address = _context.Sys_SupplierAddress.FirstOrDefault(
                ob => ob.SupplierID == entity.SupplierID && ob.IsActive && ob.IsDelete == false);

            if (address != null)
            {
                model.SupplierAddressID = address.SupplierAddressID.ToString();
                model.Address           = address.Address;
                model.ContactPerson     = address.ContactPerson;
                model.ContactNumber     = model.ContactNumber;
            }
            return(model);
        }
        public static IOBalanceDBV3Entity.Suppliers DtoToEntity(this SupplierDetails dto)
        {
            IOBalanceDBV3Entity.Suppliers entity = null;

            if (!dto.IsNull())
            {
                entity = new IOBalanceDBV3Entity.Suppliers
                {
                    SupplierID   = dto.SupplierId,
                    CreatedBy    = dto.CreatedBy,
                    DateCreated  = dto.DateCreated,
                    SupplierCode = dto.SupplierCode,
                    DateUpdated  = dto.DateUpdated,
                    IsActive     = dto.IsActive,
                    SupplierName = dto.SupplierName,
                    UpdatedBy    = dto.UpdatedBy,
                };
            }

            return(entity);
        }
Esempio n. 14
0
    protected void Suppliers_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (Suppliers.SelectedValue == "-1")
        {
            // The "Show/Edit ALL" option has been selected
            SupplierDetails.DataSourceID = "AllSuppliersDataSource";

            // Reset the page index to show the first record
            SupplierDetails.PageIndex = 0;
        }
        else
        {
            // The user picked a particular supplier
            SupplierDetails.DataSourceID = "SingleSupplierDataSource";
        }

        // Ensure that the DetailsView and GridView are in read-only mode
        SupplierDetails.ChangeMode(DetailsViewMode.ReadOnly);
        ProductsBySupplier.EditIndex = -1;

        // Need to "refresh" the DetailsView
        SupplierDetails.DataBind();
    }
Esempio n. 15
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtLedgerName.Text == string.Empty && txtNotes.Text == string.Empty && txtOpeningBal.Text == string.Empty)
                {
                    errorProvider1.Clear();
                    errorProvider1.SetError(txtLedgerName, "Enter all details.");
                    txtLedgerName.Focus();
                    panel3.Visible = true;
                    lblError.Text  = "Enter all details.";
                }
                else if (txtLedgerName.Text == string.Empty)
                {
                    errorProvider1.Clear();
                    errorProvider1.SetError(txtLedgerName, "Enter ledger-name");
                    txtLedgerName.Focus();
                    panel3.Visible = true;
                    lblError.Text  = "Enter ledger-name.";
                }
                else if (txtOpeningBal.Text == string.Empty)
                {
                    errorProvider1.Clear();
                    errorProvider1.SetError(txtOpeningBal, "Enter opening balance.");
                    txtOpeningBal.Focus();
                    panel3.Visible = true;
                    lblError.Text  = "Enter opening balance.";
                }
                else
                {
                    if (btnCreate.Text == "Create")
                    {
                        _entities = new MicroAccountsEntities1();

                        var gId       = Convert.ToInt32(cmbParentGroup.SelectedValue);
                        var checkData = _entities.tbl_AccLedger.Where(x => x.ledgerName == txtLedgerName.Text.Trim().ToString() && x.groupId == gId).FirstOrDefault();

                        if (checkData != null)
                        {
                            MessageBox.Show("Ledger already Exists. Cannot create ledger with this name");
                            return;
                        }


                        tbl_AccLedger accLedgerData = new tbl_AccLedger();
                        accLedgerData.ledgerName = txtLedgerName.Text.Trim().ToString();
                        accLedgerData.groupId    = Convert.ToInt32(cmbParentGroup.SelectedValue);
                        accLedgerData.opBalance  = Convert.ToDecimal(txtOpeningBal.Text);

                        if (cmbDRCR.SelectedItem.ToString() == "Dr")
                        {
                            accLedgerData.opBalanceDC = "D";
                        }
                        else
                        {
                            accLedgerData.opBalanceDC = "C";
                        }

                        accLedgerData.notes = txtNotes.Text.Trim().ToString();

                        if (chkBankOrCash.Checked)
                        {
                            accLedgerData.type = 1;
                        }
                        else
                        {
                            accLedgerData.type = 0;
                        }
                        accLedgerData.createdDate = DateTime.Now;
                        _entities.tbl_AccLedger.Add(accLedgerData);
                        _entities.SaveChanges();

                        tbl_LedgerDetails ledgerDetails = new tbl_LedgerDetails();

                        if (txtAddress.Text.Trim() == string.Empty)
                        {
                            ledgerDetails.address = "--";
                        }
                        else
                        {
                            ledgerDetails.address = txtAddress.Text.Trim().ToString();
                        }
                        if (txtContact.Text == string.Empty)
                        {
                            ledgerDetails.contact = 0;
                        }
                        else
                        {
                            ledgerDetails.contact = Convert.ToDecimal(txtOpeningBal.Text);
                        }

                        ledgerDetails.ledgerId    = _entities.tbl_AccLedger.Where(x => x.ledgerName == txtLedgerName.Text && x.groupId == accLedgerData.groupId).FirstOrDefault().Id;
                        ledgerDetails.createdDate = DateTime.Now;
                        ledgerDetails.updateDate  = DateTime.Now;

                        _entities.tbl_LedgerDetails.Add(ledgerDetails);
                        _entities.SaveChanges();

                        MessageBox.Show("Record Added Successfully");
                    }
                    else
                    {
                        //Update Code

                        _entities = new MicroAccountsEntities1();

                        var data = _entities.tbl_AccLedger.Where(x => x.Id == ledgerId).FirstOrDefault();

                        data.ledgerName = txtLedgerName.Text.Trim().ToString();
                        data.groupId    = Convert.ToInt32(cmbParentGroup.SelectedValue);
                        data.opBalance  = Convert.ToDecimal(txtOpeningBal.Text);

                        if (cmbDRCR.SelectedItem.ToString() == "Dr")
                        {
                            data.opBalanceDC = "D";
                        }
                        else
                        {
                            data.opBalanceDC = "C";
                        }

                        data.notes       = txtNotes.Text.Trim().ToString();
                        data.updatedDate = DateTime.Now;

                        _entities.SaveChanges();

                        var dataLedgerDetails = _entities.tbl_LedgerDetails.Where(x => x.ledgerId == ledgerId).FirstOrDefault();

                        dataLedgerDetails.address    = txtAddress.Text.Trim().ToString();
                        dataLedgerDetails.contact    = Convert.ToDecimal(txtContact.Text.Trim());
                        dataLedgerDetails.ledgerId   = _entities.tbl_AccLedger.Where(x => x.ledgerName == txtLedgerName.Text && x.groupId == data.groupId).FirstOrDefault().Id;
                        dataLedgerDetails.updateDate = DateTime.Now;

                        _entities.SaveChanges();

                        MessageBox.Show("Record Updated Successfully");
                        SupplierDetails ss = new SupplierDetails();
                        ss.dataGridBind();
                    }
                    bindComboBox();
                    clearTextBox();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong. Contact your system administrator");
            }
        }
        //Call from ajax
        public JsonResult GetDetails(int?id, DateTime?fromDate, DateTime?toDate)
        {
            var data = new SupplierDetails(_db, id.GetValueOrDefault(), fromDate, toDate);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        private void btnAddNewSupplier_Click(object sender, EventArgs e)
        {
            if (txtSupplierName.Text == "")
            {
                MessageBox.Show("Please Enter Supplier Name", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtSupplierName.Focus();
                return;
            }
            if (txtAddress.Text == "")
            {
                MessageBox.Show("Please Enter Supplier Address", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAddress.Focus();
                return;
            }
            if (txtCity.Text == "")
            {
                MessageBox.Show("Please Enter Supplier City", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCity.Focus();
                return;
            }
            if (txtEmail.Text == "")
            {
                MessageBox.Show("Please Enter Supplier Email", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmail.Focus();
                return;
            }
            if (txtContact.Text == "")
            {
                MessageBox.Show("Please Enter Supplier ContactNo.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtContact.Focus();
                return;
            }
            //if (pictureBox1.Image == null)
            //{
            //    MessageBox.Show("Please Choose Customer Image", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    pictureBox1.Focus();
            //    return;
            //}


            byte[] imgg = null;
            if (filename == "")
            {
                FileStream   stream = new FileStream(defaultfilename, FileMode.Open, FileAccess.Read);
                BinaryReader brrdr  = new BinaryReader(stream);
                imgg = brrdr.ReadBytes((int)stream.Length);
            }
            else
            {
                FileStream   stream = new FileStream(filename, FileMode.Open, FileAccess.Read);
                BinaryReader brrdr  = new BinaryReader(stream);
                imgg = brrdr.ReadBytes((int)stream.Length);
            }
            SupplierDetails sd = new SupplierDetails();

            sd.SupplierNo = txtSupplierID.Text;
            sd.S_Name     = txtSupplierName.Text;
            sd.Address    = txtAddress.Text;
            sd.City       = txtCity.Text;
            sd.Email      = txtEmail.Text;
            sd.ContactNo  = txtContact.Text;
            sd.Photo      = imgg;
            int i = bls.AddNewSupplier(sd);

            if (i > 0)
            {
                LoadGrid();
                MessageBox.Show("New Supplier Added Successfully", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Clear();
            }
        }
Esempio n. 18
0
        public bool CheckDataHavingInDataTableOrNot(AddItemBo objboAdditem, int UserId)
        {
            bool checkresult = false;

            try
            {
                if (objboAdditem.ItemCateGory != null)
                {
                    coluMnName = "ItemCategory";
                    string value = objboAdditem.ItemCateGory;
                    checkresult = objDAL.CheckDataHavingInDataTableOrNot(coluMnName, value);
                    if (!checkresult)
                    {
                        objDAL.InsertNewCategory(value, UserId);
                    }
                }
                if (objboAdditem.ItemGroup != null)
                {
                    coluMnName = "ItemGroup";
                    string checkItemcategory = objboAdditem.ItemCateGory;
                    string checkvalue        = objboAdditem.ItemGroup;
                    checkresult = objDAL.CheckItemSubGroup(coluMnName, checkItemcategory, checkvalue);
                    if (!checkresult)
                    {
                        int itemCateGoryId = objDAL.GetCategoryId(objboAdditem.ItemCateGory);
                        InsertGroup(itemCateGoryId, checkvalue, UserId);
                    }
                }

                if (objboAdditem.Supplier != null)
                {
                    coluMnName  = "Company";
                    value       = objboAdditem.Supplier;
                    checkresult = objDAL.CheckDataHavingInDataTableOrNot(coluMnName, value);
                    if (!checkresult)
                    {
                        SupplierDetails objbo        = new SupplierDetails();
                        string          supplierName = string.Empty;
                        supplierName = objboAdditem.Supplier;
                        SupplierDetails objSupplierDetails = new SupplierDetails();
                        objSupplierDetails.SupplierName      =
                            objSupplierDetails.MiddleName    = "";
                        objSupplierDetails.LastName          = "";
                        objSupplierDetails.Company           = supplierName;
                        objSupplierDetails.Displayname       = "";
                        objSupplierDetails.Mobile            = "";
                        objSupplierDetails.Email             = "";
                        objSupplierDetails.Address           = "";
                        objSupplierDetails.Phone             = "";
                        objSupplierDetails.Fax               = "";
                        objSupplierDetails.AccountNo         = "";
                        objSupplierDetails.PanNumber         = "";
                        objSupplierDetails.TaxRegistrationNo = "";
                        objSupplierDetails.SupplierCode      = "";
                        objSupplierDetails.City              = "";
                        objSupplierDetails.State             = "";
                        objSupplierDetails.Country           = "";
                        objSupplierDetails.PostalCode        = "";
                        objSupplierDetails.Notes             = "";
                        objSupplierDetails.UserId            = 0;
                        int i = AddSupplierDetails(objSupplierDetails);

                        if (i != 0)
                        {
                            checkresult = true;
                        }
                    }
                }

                return(checkresult);

                // return dt;
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ToolBAL         objBAL             = new ToolBAL();
                SupplierDetails objSupplierDetails = new SupplierDetails();
                objSupplierDetails.SupplierName = txtFirstName.Text;
                //objSupplierDetails.MiddleName = txtMiddleName.Text;
                //objSupplierDetails.LastName = txtLastName.Text;

                if (txtCompany.Text.ToString() == string.Empty)
                {
                    MessageBox.Show("Please enter company name.");
                    txtCompany.Focus();
                    return;
                }
                objSupplierDetails.Company           = txtCompany.Text;
                objSupplierDetails.Displayname       = txtDisplayName.Text;
                objSupplierDetails.Mobile            = txtMobile.Text;
                objSupplierDetails.Email             = txtEmail.Text;
                objSupplierDetails.Fax               = txtFax.Text;
                objSupplierDetails.AccountNo         = txtAccountNo.Text;
                objSupplierDetails.PanNumber         = txtPanNo.Text;
                objSupplierDetails.TaxRegistrationNo = txtRegisterNo.Text;
                if (txtSupplierCode.Text.ToString() == string.Empty)
                {
                    MessageBox.Show("Please enter Supplier Code.");
                    txtSupplierCode.Focus();
                    return;
                }
                objSupplierDetails.SupplierCode = txtSupplierCode.Text;

                //objSupplierDetails.Address = txtAddress.Text;
                //objSupplierDetails.Phone = txtPhone.Text;
                //objSupplierDetails.City = txtCity.Text;
                //objSupplierDetails.State = txtState.Text;
                //objSupplierDetails.Country = txtCountry.Text;
                //objSupplierDetails.PostalCode = txtPostalCode.Text;

                if (txtPhone.Text == "Phone")
                {
                    objSupplierDetails.Phone = string.Empty;
                }
                else
                {
                    objSupplierDetails.Phone = txtPhone.Text;
                }
                if (txtAddress.Text == "Street")
                {
                    objSupplierDetails.Address = string.Empty;
                }
                else
                {
                    objSupplierDetails.Address = txtAddress.Text;
                }
                if (txtState.Text == "State")
                {
                    objSupplierDetails.State = string.Empty;
                }
                else
                {
                    objSupplierDetails.State = txtState.Text;
                }

                if (txtCity.Text == "City/Town")
                {
                    objSupplierDetails.City = string.Empty;
                }
                else
                {
                    objSupplierDetails.City = txtCity.Text;
                }
                if (txtCountry.Text == "Country")
                {
                    objSupplierDetails.Country = string.Empty;
                }
                else
                {
                    objSupplierDetails.Country = txtCountry.Text;
                }
                if (txtPostalCode.Text == "Postal Code")
                {
                    objSupplierDetails.PostalCode = string.Empty;
                }
                else
                {
                    objSupplierDetails.PostalCode = txtPostalCode.Text;
                }

                objSupplierDetails.Notes  = txtNote.Text;
                objSupplierDetails.UserId = Login.UserId;

                int i = objBAL.AddSupplierDetails(objSupplierDetails);

                if (i != 0)
                {
                    MessageBox.Show("Data Saved Successfully.");
                    Clear();
                }
                else
                {
                    MessageBox.Show("Data Insertion Failed.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }