private void ClearControls()
        {
            var aDatabase_DB = new Digital_AppEntities();

            cmbCategory.SelectedValue    = -1;
            cmbSubcategory.SelectedValue = -1;
            txtName.Text = "";
            List <UOM> auom       = aDatabase_DB.UOMs.ToList();
            DataTable  dtItemInfo = Global.LINQToDataTable(auom);

            cmbUom.DataSource    = dtItemInfo;
            cmbUom.DisplayMember = "Name";
            cmbUom.ValueMember   = "ID";
            itemid = 0;

            List <Category> aCategory  = aDatabase_DB.Categories.ToList();
            DataTable       dtCategory = Global.LINQToDataTable(aCategory);

            cmbCategory.DataSource    = dtCategory;
            cmbCategory.DisplayMember = "Name";
            cmbCategory.ValueMember   = "ID";
            txtsalesPrice.Text        = "0";
            chkActive.Checked         = true;
            dgvItem.Rows.Clear();
            foreach (ItemInfo aitem in aDatabase_DB.ItemInfoes.OrderByDescending(c => c.ID))
            {
                dgvItem.Rows.Add(aitem.ID, aitem.Name, aitem.Category.Name, aitem.SubCategory.Name, aitem.Active);
            }
        }
Example #2
0
        private void dgPurchaseInformation_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                using (var posContext = new Digital_AppEntities())
                {
                    panel1.Visible = true;
                    panel2.Visible = false;
                    short itemPurchaseMstID = Convert.ToInt16(dgPurchaseInformation.Rows[e.RowIndex].Cells[0].Value);
                    int   index             = 0;
                    txtPoCode.Text = dgPurchaseInformation.Rows[e.RowIndex].Cells[2].Value.ToString();
                    dgvItemPurchaseDetail.Rows.Clear();
                    foreach (View_ReceivedDetails result in posContext.View_ReceivedDetails.Where(c => c.MstID == itemPurchaseMstID).ToList())
                    {
                        dgvItemPurchaseDetail.Rows.Add();
                        dgvItemPurchaseDetail.Rows[index].Cells["colID"].Value       = result.ID;
                        dgvItemPurchaseDetail.Rows[index].Cells["colItemID"].Value   = result.ProductID;
                        dgvItemPurchaseDetail.Rows[index].Cells["colItemCode"].Value = result.ItemCode;

                        //dgvItemPurchaseDetail.Rows[index].Cells["BatchNo"].Value = result.i;
                        dgvItemPurchaseDetail.Rows[index].Cells["colSalePrice"].Value         = result.SalePrice;
                        dgvItemPurchaseDetail.Rows[index].Cells["colItemName"].Value          = result.ItemName;
                        dgvItemPurchaseDetail.Rows[index].Cells["colItemPurchaseMstID"].Value = result.MstID;
                        dgvItemPurchaseDetail.Rows[index].Cells["colUnitPrice"].Value         = result.UnitPrice;
                        dgvItemPurchaseDetail.Rows[index].Cells["colQuantity"].Value          = result.Quantity;
                        dgvItemPurchaseDetail.Rows[index].Cells["colTotal"].Value             = result.Total;
                        index++;
                    }
                    this.CalculateTotal();
                }
            }
            catch
            {
            }
        }
        private void ClearForm()
        {
            this.itemPurchaseMstID = 0;
            this.txtGRNO.Text      = string.Empty;
            this.txtPO.Text        = string.Empty;
            this.txtChallanNo.Text = string.Empty;

            this.dtpGRNODate.Value = DateTime.Now;
            // this.dtpPODate.Value = DateTime.Now;
            //this.dtpChallanDate.Value = DateTime.Now;

            this.txtRemarks.Text           = txtMobileNo.Text = string.Empty;
            this.cmbSupplier.SelectedIndex = -1;
            // this.cmbCurrency.SelectedItem = "Peso";
            this.lblTotalData.Text     = "0";
            this.txtDiscount.Text      = "0";
            this.txtCarriageCharg.Text = "0";
            this.txtLabureCharge.Text  = "0";
            //this.txtTotalPayable.Text = "0";
            //this.txtDueAmount.Text = "0";
            this.dgvItemPurchaseDetail.Rows.Clear();

            using (var posContext = new Digital_AppEntities())
            {
                this.GenerateCode(posContext);
            }
            dtpGRNODate.Value = DateTime.Now;
            //dtpPODate.Value = DateTime.Now;
            // dtpChallanDate.Value = DateTime.Now;
            this.btnSave.Enabled = true;
            txtPO.Focus();
        }
        private void frmItemList_Load(object sender, EventArgs e)
        {
            using (var posContext = new Digital_AppEntities())
            {
                dgvItem.AutoGenerateColumns = false;
                //if (this.CallerForm != "frmOrder")
                //{

                dgvItem.Rows.Clear();
                if (this.CallerForm == "frmItemPurchase")
                {
                    foreach (var a in posContext.ItemInfoes)
                    {
                        dgvItem.Rows.Add(a.ID, a.Code, a.StyleNo, a.Name, a.SubCategory.Name, a.Category.Name, a.Design, a.UOMID, a.UOM.Name, a.SalePrice, 0, a.ClosingStock);
                    }
                }
                else
                {
                    foreach (var a in posContext.ItemWithUOMs.Where(v => v.UnitsInStock >= 0))
                    {
                        dgvItem.Rows.Add(a.ID, a.Code, a.StyleNo, a.Name, a.SubCategory, a.Category, a.Design, a.UOMID, a.UOMName, a.CostPrice, a.Discount, a.UnitsInStock);
                    }
                }

                //}
                //else
                //{
                //    dgvItem.DataSource = posContext.ItemFor_orders.Where(it => it.CompanyId == Global.Company.ID);
                //}
            }
        }
Example #5
0
        private void ManageSubCategory(Digital_AppEntities posContext, short categoryID)
        {
            SubCategory subCategory;

            if (subCategoryID == 0)
            {
                subCategory             = new SubCategory();
                subCategory.Code        = txtCode.Text;
                subCategory.Name        = txtName.Text;
                subCategory.Description = txtDescription.Text;
                subCategory.CategoryID  = categoryID;
                subCategory.Active      = chkActive.Checked;
                // subCategory.CreatedBy = Global.LoggedInUser.ID;
                subCategory.CreatedDate = DateTime.Now;
                posContext.SubCategories.Add(subCategory);
            }
            else
            {
                subCategory             = posContext.SubCategories.Single(id => id.ID == subCategoryID);
                subCategory.Name        = txtName.Text;
                subCategory.Description = txtDescription.Text;
                subCategory.CategoryID  = categoryID;
                subCategory.Active      = chkActive.Checked;
                // subCategory.ModifiedBy = Global.LoggedInUser.ID;
                subCategory.ModifiedDate = DateTime.Now;
            }
            posContext.SaveChanges();
            isRecordSaved = true;
            ClearControls();
            this.LoadSubCategoriesByCategoryID(categoryID);
        }
        private void RefreshAll()
        {
            GenerateCode();


            try
            {
                using (var posContext = new Digital_AppEntities())
                {
                    btnDelete.Enabled = false;
                    List <COUNTRY_INFO> aCategory  = posContext.COUNTRY_INFO.ToList();
                    DataTable           dtCategory = Global.LINQToDataTable(aCategory);
                    cmbCountry.DataSource    = dtCategory;
                    cmbCountry.DisplayMember = "COUNTRY_DESC";
                    cmbCountry.ValueMember   = "COUNTRY_CODE";
                    List <DISTRICTINFO> aDISTRICTINFO  = posContext.DISTRICTINFOes.ToList();
                    DataTable           dtDISTRICTINFO = Global.LINQToDataTable(aDISTRICTINFO);
                    cmbDistrict.DataSource    = dtDISTRICTINFO;
                    cmbDistrict.DisplayMember = "DISTRICT_NAME";
                    cmbDistrict.ValueMember   = "ID";
                    cmbDistrict.SelectedIndex = -1;
                    dgvFarmer.Rows.Clear();

                    foreach (var a in posContext.FarmerInfoes.OrderByDescending(c => c.ID).ToList())
                    {
                        dgvFarmer.Rows.Add(a.ID, a.Code, a.FarmerName, a.FarmerName, a.MotherName, a.MobileNo, a.Email, a.Address, a.PostalCode, a.COUNTRY_INFO.COUNTRY_DESC, a.Active);
                    }
                }
            }

            catch
            {
            }
        }
Example #7
0
        private void ClearControls()
        {
            categoryID = 0;
            using (var posContext = new Digital_AppEntities())
            {
                var categories = posContext.Categories;
                if (categories.Count() == 0)
                {
                    txtCode.Text = "1".PadLeft(3, '0');
                }
                else
                {
                    Category category = categories.OrderByDescending(id => id.ID).Take(1).Single();
                    txtCode.Text = (Convert.ToInt16(category.Code) + 1).ToString().PadLeft(3, '0');
                }
                dgvCategory.Rows.Clear();
                dgvCategory.AutoGenerateColumns = false;
                foreach (Category actegory in posContext.Categories.OrderByDescending(id => id.ID))
                {
                    dgvCategory.Rows.Add(actegory.ID, actegory.Code, actegory.Name, actegory.Description, actegory.Active);
                }
            }


            txtName.Text        = string.Empty;
            txtDescription.Text = string.Empty;
            chkActive.Checked   = true;
            txtName.Focus();
        }
Example #8
0
        private void frmSubCategry_Load(object sender, EventArgs e)
        {
            using (var posContext = new Digital_AppEntities())
            {
                //cmbCategory.DataSource = posContext.Categories.Where(id => id.Active == true); ;
                // cmbCategory.SelectedIndex = -1;
                List <Category> auom       = posContext.Categories.ToList();
                DataTable       dtItemInfo = Global.LINQToDataTable(auom);
                cmbCategory.DataSource    = dtItemInfo;
                cmbCategory.DisplayMember = "Name";
                cmbCategory.ValueMember   = "ID";

                cmbCategorySearch.DataSource    = dtItemInfo;
                cmbCategorySearch.DisplayMember = "Name";
                cmbCategorySearch.ValueMember   = "ID";

                //cmbCategorySearch.DataSource = posContext.Categories.Where(id => id.Active == true); ;
                //cmbCategorySearch.SelectedIndex = -1;
                txtCode.Text = string.Empty;
                dgvSubCategory.AutoGenerateColumns = false;
                dgvSubCategory.Rows.Clear();

                foreach (var subCategory in posContext.SubCategories.OrderByDescending(id => id.ID))
                {
                    dgvSubCategory.Rows.Add(subCategory.ID, subCategory.Code, subCategory.Name, subCategory.Description, subCategory.CategoryID, subCategory.Category.Name, subCategory.Active);
                }
            }
        }
Example #9
0
        private void dgPurchaseInformation_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            using (var posContext = new Digital_AppEntities())
            {
                short itemPurchaseMstID = Convert.ToInt16(dgPurchaseInformation.Rows[e.RowIndex].Cells[0].Value);
                int   index             = 0;
                dgvItemPurchaseDetail.Rows.Clear();
                foreach (View_GetItemPurchaseDetails result in posContext.View_GetItemPurchaseDetails.Where(c => c.ItemPurchaseMstID == itemPurchaseMstID).ToList())
                {
                    dgvItemPurchaseDetail.Rows.Add();
                    dgvItemPurchaseDetail.Rows[index].Cells["colID"].Value       = result.ID;
                    dgvItemPurchaseDetail.Rows[index].Cells["colItemID"].Value   = result.ItemID;
                    dgvItemPurchaseDetail.Rows[index].Cells["colItemCode"].Value = result.ItemCode;

                    //dgvItemPurchaseDetail.Rows[index].Cells["BatchNo"].Value = result.i;
                    // dgvItemPurchaseDetail.Rows[index].Cells["colItemCode"].Value = result.ItemCode;
                    dgvItemPurchaseDetail.Rows[index].Cells["ColSalesPrice"].Value        = result.SalePrice;
                    dgvItemPurchaseDetail.Rows[index].Cells["colItemName"].Value          = result.ItemName;
                    dgvItemPurchaseDetail.Rows[index].Cells["colItemPurchaseMstID"].Value = result.ItemPurchaseMstID;
                    dgvItemPurchaseDetail.Rows[index].Cells["colUnitPrice"].Value         = result.UnitPrice;
                    dgvItemPurchaseDetail.Rows[index].Cells["colQuantity"].Value          = result.Quantity;
                    dgvItemPurchaseDetail.Rows[index].Cells["colTotal"].Value             = result.Total;
                    //dgPurchaseInformation.Rows[index].Cells["Expairedate"].Value = result.ExpireDate;
                    index++;
                }
            }
        }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (txtSearchItem.TextLength > 0)
            {
                using (var posContext = new Digital_AppEntities())
                {
                    LBSearchItem.Location = new System.Drawing.Point(128, 362);
                    LBSearchItem.Width    = 186;
                    LBSearchItem.Height   = 150;

                    //vrEmployee=posContext.View_Employee.ToList();
                    // var aItemInformations = posContext.ItemInfoes.Where(a => a.Active == true && (a.Name+a.Code).ToUpper().Contains(txtSearchItem.Text.ToUpper())).ToList();
                    List <ItemInfo> aItemInformations = posContext.ItemInfoes.Where(a => a.Active == true && (a.Name + a.Code).ToUpper().Contains(txtSearchItem.Text.ToUpper())).ToList();
                    if (aItemInformations.Count > 0)
                    {
                        DataTable dtCompany = Global.LINQToDataTable(aItemInformations);
                        LBSearchItem.DataSource    = dtCompany;
                        LBSearchItem.DisplayMember = "Name";
                        LBSearchItem.ValueMember   = "ID";
                        LBSearchItem.Visible       = true;
                    }
                    else
                    {
                        LBSearchItem.Visible = false;
                    }

                    //btnSave.Focus();
                }
            }
            else
            {
                lblItemID.Text       = "";
                LBSearchItem.Visible = false;
            }
        }
Example #11
0
        private void ClearControls()
        {
            customerID = 0;
            //cmbContactTitle.SelectedIndex = 0;
            txtContactName.Text = string.Empty;
            txtMobile.Text      = string.Empty;
            txtPhone.Text       = string.Empty;
            txtFax.Text         = string.Empty;
            txtEmail.Text       = string.Empty;

            txtAddress1.Text        = string.Empty;
            txtAddress2.Text        = string.Empty;
            txtCity.Text            = string.Empty;
            txtState.Text           = string.Empty;
            txtPostalCode.Text      = string.Empty;
            cmbCountry.SelectedItem = "Bangladesh";

            chkActive.Checked = true;

            if (!isRecordSaved)
            {
                if (dgvCustomer.Rows.Count > 0)
                {
                    dgvCustomer.ClearSelection();
                }
            }
            using (var posContext = new Digital_AppEntities())
            {
                dgvCustomer.Rows.Clear();
                foreach (CustomerInformation a in posContext.CustomerInformations.OrderByDescending(a => a.ID))
                {
                    dgvCustomer.Rows.Add(a.ID, a.Code, a.FullName, a.Mobile, a.Phone, a.Fax, a.Email, a.Address1, a.Address2, a.City, a.State, a.PostalCode, a.Country, a.DateOfBirth, a.Maragedate, a.Active);
                }
            }
        }
Example #12
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     isRecordSaved = false;
     ClearControls();
     using (var posContext = new Digital_AppEntities())
     { this.GenerateCode(posContext); }
     txtContactName.Focus();
 }
Example #13
0
 private void txtSearch_TextChanged(object sender, EventArgs e)
 {
     using (var posContext = new Digital_AppEntities())
     {
         dgvCustomer.AutoGenerateColumns = false;
         dgvCustomer.DataSource          = posContext.CustomerInformations.Where(id => (id.Code + id.ContactPerson + id.Mobile + id.Phone + id.Fax + id.Email).Contains(txtSearch.Text));
     }
 }
Example #14
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var posContext = new Digital_AppEntities();
                {
                    Category category;
                    if (categoryID == 0)
                    {
                        if (CheckInput())
                        {
                            return;
                        }
                        category             = new Category();
                        category.Code        = txtCode.Text;
                        category.Name        = txtName.Text;
                        category.Description = txtDescription.Text.Trim();
                        category.Active      = chkActive.Checked;
                        //  category.CreatedBy = (short)Global.LoggedInUser.ID;
                        category.CreatedDate = DateTime.Now;
                        posContext.Categories.Add(category);
                    }
                    else
                    {
                        category             = posContext.Categories.Single(id => id.ID == categoryID);
                        category.Name        = txtName.Text;
                        category.Description = txtDescription.Text.Trim();
                        category.Active      = chkActive.Checked;
                        // category.ModifiedBy = Global.LoggedInUser.ID;
                        category.ModifiedDate = DateTime.Now;
                    }
                    posContext.SaveChanges();
                    // dgvCategory.DataSource = posContext.Categories.OrderByDescending(id => id.ID);
                }
                this.ClearControls();
            }
            catch (Exception ex)
            {
                if (ex.InnerException.GetType().Name == "SqlException")
                {
                    int errorNumber = ((System.Data.SqlClient.SqlException)(ex.InnerException)).Number;
                    switch (errorNumber)
                    {
                    case 2601:
                        MessageBox.Show(MessageManager.GetDuplicateErrorMsg(this.Text.ToLower()), Global.ApplicationNameWithVersion, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;

                    default:
                        MessageBox.Show(MessageManager.CommonExceptionMsg, Global.ApplicationNameWithVersion, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }
                }
                else
                {
                    MessageBox.Show(MessageManager.CommonExceptionMsg, Global.ApplicationNameWithVersion, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #15
0
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     using (var posContext = new Digital_AppEntities())
     {
         dgPurchaseInformation.Rows.Clear();
         foreach (View_PurchaseInformation aView_PurchaseInformation in posContext.View_PurchaseInformation.Where(i => (i.PoCode + i.SupplierMobileNo + i.FarmerName).Contains(textBox1.Text) && i.CreatedBy == Global.UserLoginID).ToList().OrderByDescending(a => a.ID))
         {
             dgPurchaseInformation.Rows.Add(aView_PurchaseInformation.ID, aView_PurchaseInformation.PODate, aView_PurchaseInformation.PoCode, aView_PurchaseInformation.FarmerName, aView_PurchaseInformation.SupplierMobileNo, aView_PurchaseInformation.ItemQuantity, aView_PurchaseInformation.Total, aView_PurchaseInformation.Satt, "Click Request");
         }
     }
 }
 private void frmPurhaseAprovedInfo_Load(object sender, EventArgs e)
 {
     using (var posContext = new Digital_AppEntities())
     {
         dgPurchaseInformation.Rows.Clear();
         foreach (View_PurchaseInformation aView_PurchaseInformation in posContext.View_PurchaseInformation.ToList().OrderByDescending(a => a.ID))
         {
             dgPurchaseInformation.Rows.Add(aView_PurchaseInformation.ID, aView_PurchaseInformation.PODate, aView_PurchaseInformation.PoCode, aView_PurchaseInformation.FarmerName, aView_PurchaseInformation.SupplierMobileNo, aView_PurchaseInformation.ItemQuantity, aView_PurchaseInformation.Total, aView_PurchaseInformation.Satt);
         }
     }
 }
Example #17
0
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     using (var posContext = new Digital_AppEntities())
     {
         dgPurchaseInformation.Rows.Clear();
         foreach (View_PurchaseInformation aView_PurchaseInformation in posContext.View_PurchaseInformation.Where(a => a.Satatus != "S" && a.Satatus != "R" && a.Satatus != null && (a.PoCode + a.Satt + a.SupplierMobileNo + a.FarmerName).Contains(textBox1.Text)).ToList().OrderByDescending(a => a.ID))
         {
             dgPurchaseInformation.Rows.Add(aView_PurchaseInformation.ID, aView_PurchaseInformation.PODate, aView_PurchaseInformation.PoCode, aView_PurchaseInformation.FarmerName, aView_PurchaseInformation.SupplierMobileNo, aView_PurchaseInformation.ItemQuantity, aView_PurchaseInformation.Total, aView_PurchaseInformation.Satt, "Panding");
         }
     }
 }
        private void dgvItemPurchaseMst_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            using (var posContext = new Digital_AppEntities())
            {
                // ItemPurchaseMst aItemPurchaseMst = posContext.ItemPurchaseMsts.SingleOrDefault(s => s.ID == Convert.ToInt32(dgvItemPurchaseMst.CurrentRow.Cells["dgvID"].Value));

                this.itemPurchaseMstID = Convert.ToInt16(dgvItemPurchaseMst.CurrentRow.Cells["dgvID"].Value);
                this.txtGRNO.Text      = dgvItemPurchaseMst.CurrentRow.Cells["dgvGRN"].Value.ToString();
                this.dtpGRNODate.Value = Convert.ToDateTime(dgvItemPurchaseMst.CurrentRow.Cells["DgvReceiveDate"].Value);
                this.txtPO.Text        = dgvItemPurchaseMst.CurrentRow.Cells["dgvPO"].Value.ToString();
                // this.dtpPODate.Value = Convert.ToDateTime(dgvItemPurchaseMst.CurrentRow.Cells["dgvPODate"].Value);
                this.txtChallanNo.Text = dgvItemPurchaseMst.CurrentRow.Cells["dgvChallanNo"].Value.ToString();
                // this.dtpChallanDate.Value = Convert.ToDateTime(dgvItemPurchaseMst.CurrentRow.Cells["dgvChallanDate"].Value);
                if (dgvItemPurchaseMst.CurrentRow.Cells["dgvSupplierID"].Value != null)
                {
                    this.cmbSupplier.SelectedValue = Convert.ToInt16(dgvItemPurchaseMst.CurrentRow.Cells["dgvSupplierID"].Value);
                }
                else
                {
                    this.cmbSupplier.SelectedIndex = -1;
                }
                //this.cmbCurrency.SelectedItem = dgvItemPurchaseMst.CurrentRow.Cells["dgvCurrency"].Value;
                this.txtRemarks.Text      = dgvItemPurchaseMst.CurrentRow.Cells["dgvRemarks"].Value.ToString();
                this.txtDiscount.Text     = dgvItemPurchaseMst.CurrentRow.Cells["dgvDiscount"].Value.ToString();
                txtMobileNo.Text          = dgvItemPurchaseMst.CurrentRow.Cells["dgvCCharge"].Value.ToString();
                this.txtLabureCharge.Text = dgvItemPurchaseMst.CurrentRow.Cells["dgvlCharge"].Value.ToString();
                Discount = Convert.ToDecimal(txtDiscount.Text);

                this.dgvItemPurchaseDetail.AutoGenerateColumns = false;
                this.dgvItemPurchaseDetail.Rows.Clear();
                int index = 0;
                foreach (View_GetItemPurchaseDetails result in posContext.View_GetItemPurchaseDetails.Where(c => c.ItemPurchaseMstID == itemPurchaseMstID).ToList())
                {
                    dgvItemPurchaseDetail.Rows.Add();
                    dgvItemPurchaseDetail.Rows[index].Cells["colID"].Value       = result.ID;
                    dgvItemPurchaseDetail.Rows[index].Cells["colItemID"].Value   = result.ItemID;
                    dgvItemPurchaseDetail.Rows[index].Cells["colItemCode"].Value = result.ItemCode;

                    //dgvItemPurchaseDetail.Rows[index].Cells["BatchNo"].Value = result.i;
                    // dgvItemPurchaseDetail.Rows[index].Cells["colItemCode"].Value = result.ItemCode;

                    dgvItemPurchaseDetail.Rows[index].Cells["colItemName"].Value          = result.ItemName;
                    dgvItemPurchaseDetail.Rows[index].Cells["colItemPurchaseMstID"].Value = result.ItemPurchaseMstID;
                    dgvItemPurchaseDetail.Rows[index].Cells["colUnitPrice"].Value         = result.UnitPrice;
                    dgvItemPurchaseDetail.Rows[index].Cells["colQuantity"].Value          = result.Quantity;
                    dgvItemPurchaseDetail.Rows[index].Cells["colTotal"].Value             = result.Total;
                    index++;
                }

                //btnBillPay.Enabled = false;
                this.tcItemPurchase.SelectedTab = tpItemPurchase;
                //dgvItemPurchaseDetail.Rows[0].Cells["colItemCode"].Selected = false;
            }
        }
Example #19
0
 private void Cleardata()
 {
     using (var posContext = new Digital_AppEntities())
     {
         dgPurchaseInformation.Rows.Clear();
         foreach (View_PurchaseInformation aView_PurchaseInformation in posContext.View_PurchaseInformation.Where(i => i.CreatedBy == Global.UserLoginID).ToList().OrderByDescending(a => a.ID))
         {
             dgPurchaseInformation.Rows.Add(aView_PurchaseInformation.ID, aView_PurchaseInformation.PODate, aView_PurchaseInformation.PoCode, aView_PurchaseInformation.FarmerName, aView_PurchaseInformation.SupplierMobileNo, aView_PurchaseInformation.ItemQuantity, aView_PurchaseInformation.Total, aView_PurchaseInformation.Satt, "Click Request");
         }
     }
 }
Example #20
0
 private void Cleardata()
 {
     using (var posContext = new Digital_AppEntities())
     {
         dgPurchaseInformation.Rows.Clear();
         foreach (View_PurchaseInformation aView_PurchaseInformation in posContext.View_PurchaseInformation.Where(a => a.Satatus != "S" && a.Satatus != "R" && a.Satatus != null).ToList().OrderByDescending(a => a.ID))
         {
             dgPurchaseInformation.Rows.Add(aView_PurchaseInformation.ID, aView_PurchaseInformation.PODate, aView_PurchaseInformation.PoCode, aView_PurchaseInformation.FarmerName, aView_PurchaseInformation.SupplierMobileNo, aView_PurchaseInformation.ItemQuantity, aView_PurchaseInformation.Total, aView_PurchaseInformation.Satt, "Panding");
         }
     }
 }
Example #21
0
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     using (var posContext = new Digital_AppEntities())
     {
         dgPurchaseInformation.Rows.Clear();
         foreach (View_ProductReceivedInformation aView_PurchaseInformation in posContext.View_ProductReceivedInformation.Where(a => a.Satatus == "S" && (a.PoCode + a.SupplierMobileNo + a.FarmerName + a.ChallanNo).Contains(textBox1.Text)).ToList().OrderByDescending(a => a.ID))
         {
             dgPurchaseInformation.Rows.Add(aView_PurchaseInformation.ID, Convert.ToDateTime(aView_PurchaseInformation.PODate).ToString("dd/MM/yyyy"), aView_PurchaseInformation.PoCode, aView_PurchaseInformation.FarmerName, aView_PurchaseInformation.SupplierMobileNo, aView_PurchaseInformation.ItemQuantity, aView_PurchaseInformation.Total);
         }
     }
 }
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     using (var posContext = new Digital_AppEntities())
     {
         dgvItemPurchaseMst.Rows.Clear();
         foreach (var a in posContext.View_GetItemPurchaseMst.Where(s => s.Keyword.Contains(textBox1.Text) && s.CreatedBy == Global.UserLoginID))
         {
             //  this.dgvItemPurchaseMst.DataSource = posContext.GetItemPurchaseMst(pageSize, Convert.ToInt16(this.currentPage), "AV", txtSearch.Text);
             dgvItemPurchaseMst.Rows.Add(a.ID, a.GRN, a.ReceivedDate, a.PO, a.PODate, a.ChallanNo, a.ChallanDate, a.SupplierID, a.SupplierName, a.Total, a.Currency, a.Remarks, a.RowNum, a.TotalRows, a.discount, a.SupplierMobileNo, a.labure_charge);
         }
     }
 }
 private void frmUOM_Load(object sender, EventArgs e)
 {
     using (var posContext = new Digital_AppEntities())
     {
         dgvUOM.AutoGenerateColumns = false;
         //dgvUOM.DataSource = posContext.UOMs;
         foreach (UOM auom in posContext.UOMs.OrderByDescending(c => c.ID))
         {
             dgvUOM.Rows.Add(auom.ID, auom.Name, auom.Active);
         }
     }
 }
Example #24
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     //string date = Convert.ToDateTime(a.PODate);
     using (var posContext = new Digital_AppEntities())
     {
         dgPurchaseInformation.Rows.Clear();
         foreach (View_ProductReceivedInformation aView_PurchaseInformation in posContext.View_ProductReceivedInformation.Where(a => a.Satatus == "S" && a.PODate >= dttpFromDate.Value.Date && a.PODate <= dtpTodate.Value.Date).ToList().OrderByDescending(a => a.ID))
         {
             dgPurchaseInformation.Rows.Add(aView_PurchaseInformation.ID, Convert.ToDateTime(aView_PurchaseInformation.PODate).ToString("dd/MM/yyyy"), aView_PurchaseInformation.PoCode, aView_PurchaseInformation.FarmerName, aView_PurchaseInformation.SupplierMobileNo, aView_PurchaseInformation.ItemQuantity, aView_PurchaseInformation.Total);
         }
     }
 }
Example #25
0
        private void GenerateCode(Digital_AppEntities posContext)
        {
            var customers = posContext.Customers;

            if (customers.Count() == 0)
            {
                txtCode.Text = "D" + DateTime.Now.ToString("yyyy") + DateTime.Now.ToString("MM") + MainBranchID.ToString().PadLeft(2, '0') + "1".PadLeft(5, '0');
            }
            else
            {
                Customer customer = customers.OrderByDescending(id => id.ID).Take(1).Single();
                txtCode.Text = "D" + DateTime.Now.ToString("yyyy") + DateTime.Now.ToString("MM") + MainBranchID.ToString().PadLeft(2, '0') + ((customer.ID + 1).ToString()).PadLeft(5, '0');
            }
        }
        private void GenerateCode()
        {
            Digital_AppEntities posContext = new Digital_AppEntities();
            var suppliers = posContext.FarmerInfoes;

            if (suppliers.Count() == 0)
            {
                txtcode.Text = "FR-" + "1".PadLeft(6, '0');
            }
            else
            {
                FarmerInfo supplier = suppliers.OrderByDescending(id => id.ID).Take(1).Single();
                txtcode.Text = "FR-" + ((Convert.ToInt16(supplier.Code.Substring(4)) + 1).ToString().PadLeft(6, '0'));
            }
        }
 private void dgvItem_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     using (var aDatabase_DB = new Digital_AppEntities())
     {
         itemid = (int)dgvItem.CurrentRow.Cells[0].Value;
         ItemInfo aItemInfo = aDatabase_DB.ItemInfoes.SingleOrDefault(c => c.ID == itemid);
         txtID.Text   = aItemInfo.ID.ToString();
         txtName.Text = aItemInfo.Name;
         cmbCategory.SelectedValue    = aItemInfo.CategoryId;
         cmbSubcategory.SelectedValue = aItemInfo.SubcategoryID;
         cmbUom.SelectedValue         = aItemInfo.UOMID;
         txtsalesPrice.Text           = aItemInfo.SalePrice.ToString();
         chkActive.Checked            = (bool)aItemInfo.Active;
     }
 }
Example #28
0
 private void frmCustomer_Load(object sender, EventArgs e)
 {
     // MainBranchID = IdManager.GetShowSingleValueInt("ServerID", "MainBranch", "BranchInfo", "1");
     using (var posContext = new Digital_AppEntities())
     {
         GenerateCode(posContext);
         // cmbContactTitle.SelectedIndex = 0;
         LoadCustomers(posContext);
         dgvCustomer.Rows.Clear();
         foreach (CustomerInformation a in posContext.CustomerInformations.OrderByDescending(a => a.ID))
         {
             dgvCustomer.Rows.Add(a.ID, a.Code, a.FullName, a.Mobile, a.Phone, a.Fax, a.Email, a.Address1, a.Address2, a.City, a.State, a.PostalCode, a.Country, a.DateOfBirth, a.Maragedate, a.Active);
         }
         //Global.LoadCountry(cmbCountry);
     }
 }
Example #29
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //if (cmbCategory.SelectedIndex == -1)
            //    MessageBox.Show(MessageManager.CategoryRequired, Global.ApplicationNameWithVersion, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //else
            //{
            try
            {
                using (var posContext = new Digital_AppEntities())
                {
                    string name                = txtName.Text.Trim();
                    short  categoryID          = Convert.ToInt16(cmbCategory.SelectedValue);
                    var    existingSubCategory = posContext.SubCategories.FirstOrDefault(id => id.Name == name && id.CategoryID == categoryID);

                    if (existingSubCategory != null)
                    {
                        if (existingSubCategory.ID == subCategoryID)
                        {
                            this.ManageSubCategory(posContext, categoryID);
                        }
                        else
                        {
                            MessageBox.Show(MessageManager.GetDuplicateErrorMsg(this.Text.ToLower()), Global.ApplicationNameWithVersion, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        ManageSubCategory(posContext, categoryID);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    if (ex.InnerException.GetType().Name == "SqlException")
                    {
                        MessageBox.Show(ex.InnerException.Message, Global.ApplicationNameWithVersion, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show(MessageManager.CommonExceptionMsg, Global.ApplicationNameWithVersion, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            //}
        }
        public bool CheckInput()
        {
            var posContext = new Digital_AppEntities();

            string name       = txtName.Text;
            var    searchData = posContext.UOMs.ToList();

            foreach (var itemData in searchData)
            {
                if (itemData.Name == name)
                {
                    MessageBox.Show("Sorry  This Item alrady Exist ;", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    return(true);
                }
            }
            return(false);
        }