public void FillForm()
        {
            try
            {
                string sellerIDObj = Request.QueryString[Constants.querySellerID];

                if (!string.IsNullOrEmpty(sellerIDObj))
                {
                    int sellerID = Convert.ToInt32(sellerIDObj);
                    if (sellerID > 0)
                    {
                        var sellerCollection = context.Sellers.Where(x => x.IsActive == true && x.SellerID == sellerID);
                        if (sellerCollection.Count() > 0)
                        {
                            Database.Seller seller = sellerCollection.FirstOrDefault();
                            txtAccountHolderName.Text = seller.AccountHolderName;
                            txtAccountNo.Text         = seller.AccountNo;
                            txtBankName.Text          = seller.BankName;
                            txtIFSC.Text          = seller.IFSCCode;
                            txtLandline.Text      = seller.SellerLandline;
                            txtMobile.Text        = seller.SellerMobile;
                            txtSellerAddress.Text = seller.SellerAddress;
                            txtSellerName.Text    = seller.SellerName;
                            txtTinNo.Text         = seller.TINNo;
                            txtVatNo.Text         = seller.VATNo;
                            txtEmail.Text         = seller.SellerEmail;

                            hdnSellerID.Value = Convert.ToString(seller.SellerID);
                        }
                        else
                        {
                            lblMessage.Text      = "Seller Not Found";
                            lblMessage.ForeColor = Color.Red;
                        }
                    }
                    else
                    {
                        lblMessage.Text      = "Seller ID Not Valid";
                        lblMessage.ForeColor = Color.Red;
                    }
                }
                else
                {
                    lblMessage.Text      = "Seller ID Not in right format";
                    lblMessage.ForeColor = Color.Red;
                }
            }
            catch
            {
                throw;
            }
        }
예제 #2
0
        protected void ddlBillNo_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (ddlBillNo.SelectedValue != "0")
                {
                    string orderType = ddlOrderType.SelectedValue;
                    panelDetail.Visible   = true;
                    divPersonName.Visible = true;
                    divmobile.Visible     = true;

                    //For Sale Order
                    if (orderType == "1")
                    {
                        int saleOrderID         = Convert.ToInt32(ddlBillNo.SelectedValue);
                        var saleOrderCollection = context.SalesOrders.Where(x => x.IsActive == true && x.SaleOrderID == saleOrderID);
                        if (saleOrderCollection.Count() > 0)
                        {
                            Database.SalesOrder saleOrder = saleOrderCollection.FirstOrDefault();
                            Database.Customer   customer  = context.Customers.Where(x => x.IsActive == true && x.CustomerID == saleOrder.CustomerID).SingleOrDefault();
                            txtMobile.Text        = customer.CustomerMobile;
                            txtPersonOrgName.Text = customer.CustomerName;
                            txtRemainingAmt.Text  = Convert.ToString(saleOrder.RemainingAmount);
                            divSeller.Visible     = false;
                        }
                    }

                    //For Purchase Order
                    if (orderType == "2")
                    {
                        int purchaseOrderID         = Convert.ToInt32(ddlBillNo.SelectedValue);
                        var purchaseOrderCollection = context.InventoryOrders.Where(x => x.IsActive == true && x.InventoryOrderID == purchaseOrderID);
                        if (purchaseOrderCollection.Count() > 0)
                        {
                            Database.InventoryOrder invOrder = purchaseOrderCollection.FirstOrDefault();
                            Database.Seller         seller   = context.Sellers.Where(x => x.IsActive == true && x.SellerID == invOrder.SellerID).SingleOrDefault();
                            txtMobile.Text        = seller.SellerMobile;
                            txtPersonOrgName.Text = seller.SellerName;
                            txtRemainingAmt.Text  = Convert.ToString(invOrder.BalanceAmount);
                            divcustomer.Visible   = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Helper.LogError(ex);
                lblMessage.Text      = "Something went Wrong kindly check log";
                lblMessage.ForeColor = Color.Red;
            }
        }
예제 #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                var sellerCollection = context.Sellers.Where(x => x.IsActive == true && x.SellerName == txtSellerName.Text && x.SellerMobile == txtMobile.Text);
                if (sellerCollection.Count() == 0)
                {
                    Database.Seller seller = new Database.Seller();
                    seller.AccountHolderName = txtAccountHolderName.Text;
                    seller.AccountNo         = txtAccountNo.Text;
                    seller.BankName          = txtBankName.Text;
                    seller.CreatedBy         = currentUserName;
                    seller.CreatedDate       = DateTime.Now.Date;
                    seller.IFSCCode          = txtIFSC.Text;
                    seller.SellerAddress     = txtSellerAddress.Text;
                    seller.SellerLandline    = txtLandline.Text;
                    seller.SellerMobile      = txtMobile.Text;
                    seller.SellerName        = txtSellerName.Text;
                    seller.TINNo             = txtTinNo.Text;
                    seller.VATNo             = txtVatNo.Text;
                    seller.SellerEmail       = txtEmail.Text;
                    seller.IsActive          = true;
                    context.Sellers.Add(seller);
                    context.SaveChanges();

                    lblMessage.Text      = "Seller Added Successfully";
                    lblMessage.ForeColor = Color.Green;
                    ClearForm();
                }
                else
                {
                    lblMessage.Text      = "Seller Already exist with same name or Mobile";
                    lblMessage.ForeColor = Color.Red;
                }
            }
            catch (Exception ex)
            {
                Helper.LogError(ex);
                lblMessage.Text      = "Something went Wrong kindly check log";
                lblMessage.ForeColor = Color.Red;
            }
        }
예제 #4
0
        protected void btnPopupAddSeller_Click(object sender, EventArgs e)
        {
            try
            {
                var sellerCollection = context.Sellers.Where(x => x.IsActive == true && x.SellerName == txtPopupSellerName.Text && x.SellerMobile == txtPopupSellerMobile.Text);
                if (sellerCollection.Count() == 0)
                {
                    Database.Seller seller = new Database.Seller();
                    seller.CreatedBy      = currentUserName;
                    seller.CreatedDate    = DateTime.Now.Date;
                    seller.SellerLandline = txtPopupSellerLandline.Text;
                    seller.SellerMobile   = txtPopupSellerMobile.Text;
                    seller.SellerName     = txtPopupSellerName.Text;
                    seller.SellerEmail    = txtPopupSellerEmail.Text;
                    seller.IsActive       = true;
                    context.Sellers.Add(seller);
                    context.SaveChanges();

                    txtAutoSeller.Text = seller.SellerName;
                    txtSellerID.Text   = Convert.ToString(seller.SellerID);

                    lblPopupSellerResult.Text      = "Seller Added Successfully";
                    lblPopupSellerResult.ForeColor = Color.Green;
                    ClearPopup();
                    divAddSellerScript.Visible = false;
                }
                else
                {
                    lblPopupSellerResult.Text      = "Seller Already exist with same name or Mobile";
                    lblPopupSellerResult.ForeColor = Color.Red;
                    divAddSellerScript.Visible     = true;
                }
            }
            catch (Exception ex)
            {
                Helper.LogError(ex);
                lblPopupSellerResult.Text      = "Something went Wrong kindly check log";
                lblPopupSellerResult.ForeColor = Color.Red;
                divAddSellerScript.Visible     = true;
            }
        }
예제 #5
0
        public void FillForm()
        {
            try
            {
                string PurchaseOrderIDObj = Request.QueryString[Constants.queryPurchaseOrderID];

                if (!string.IsNullOrEmpty(PurchaseOrderIDObj))
                {
                    int PurchaseOrderID = Convert.ToInt32(PurchaseOrderIDObj);
                    if (PurchaseOrderID > 0)
                    {
                        var PurchaseOrderCollection = context.InventoryOrders.Where(x => x.InventoryOrderID == PurchaseOrderID);
                        if (PurchaseOrderCollection.Count() > 0)
                        {
                            //Fill Other Form Data
                            Database.InventoryOrder purchaseOrder = PurchaseOrderCollection.FirstOrDefault();

                            txtAmountPaidDate.Text        = purchaseOrder.AmountPaidDate.GetValueOrDefault().ToString(Constants.DateFormatDatePicker);
                            txtBalance.Text               = Convert.ToString(purchaseOrder.BalanceAmount);
                            txtBillDate.Text              = purchaseOrder.BillDate.GetValueOrDefault().ToString(Constants.DateFormatDatePicker);
                            txtDetails.Text               = purchaseOrder.Remarks;
                            txtOwnBillNo.Text             = purchaseOrder.OwnBillNo;
                            txtPaidAmount.Text            = Convert.ToString(purchaseOrder.AmountPaid);
                            txtPurchaseBillNO.Text        = purchaseOrder.PurchaseBillNo;
                            txtPurchaseDate.Text          = purchaseOrder.PurchaseDate.GetValueOrDefault().ToString(Constants.DateFormatDatePicker);
                            txtTotalOrderAmount.Text      = Convert.ToString(purchaseOrder.TotalOrderAmount);
                            ddlCustomerType.SelectedValue = Convert.ToString(purchaseOrder.CustomerTypeID);
                            txtSellerID.Text              = Convert.ToString(purchaseOrder.SellerID);
                            Database.Seller seller = context.Sellers.Where(x => x.SellerID == purchaseOrder.SellerID).FirstOrDefault();
                            txtAutoSeller.Text       = seller.SellerName;
                            chkOrderComplete.Checked = Convert.ToBoolean(purchaseOrder.IsCompleted);

                            //Fill Repeater Data
                            var invOrderCollection = context.InventoryOrderDetails.Where(x => x.InventoryOrderID == purchaseOrder.InventoryOrderID).ToList();
                            if (invOrderCollection.Count() > 0)
                            {
                                var purchaseOrders = from invOrder in invOrderCollection
                                                     join inv in context.InventoryTypes on invOrder.InventoryTypeID equals inv.InventoryTypeId
                                                     select new rptrClass
                                {
                                    ItemID        = invOrder.InventoryTypeID,
                                    ItemName      = inv.InventoryTypeName,
                                    PurchaseRate  = invOrder.PurchaseRate,
                                    Quantity      = invOrder.Quantity,
                                    SellingRate   = invOrder.SaleRate,
                                    TotalAmount   = invOrder.TotalItemsCost,
                                    VAT           = invOrder.VatNo,
                                    ItemCode      = inv.InventoryCode,
                                    OrderDetailID = invOrder.InventoryOrderDetailID
                                };
                                rptrData.DataSource = purchaseOrders.ToList();
                                rptrData.DataBind();
                            }
                        }
                        else
                        {
                            lblMessage.Text      = "PurchaseOrder Not Found";
                            lblMessage.ForeColor = Color.Red;
                        }
                    }
                    else
                    {
                        lblMessage.Text      = "PurchaseOrder ID Not Valid";
                        lblMessage.ForeColor = Color.Red;
                    }
                }
                else
                {
                    lblMessage.Text      = "PurchaseOrder ID Not in right format";
                    lblMessage.ForeColor = Color.Red;
                }
            }
            catch
            {
                throw;
            }
        }
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         string sellerIDObj = hdnSellerID.Value;
         if (!string.IsNullOrEmpty(sellerIDObj))
         {
             int sellerID = Convert.ToInt32(sellerIDObj);
             if (sellerID > 0)
             {
                 var sellerCollection = context.Sellers.Where(x => x.IsActive == true && x.SellerID == sellerID);
                 if (sellerCollection.Count() > 0)
                 {
                     var customerCollection = context.Sellers.Where(x => x.IsActive == true && x.SellerName == txtSellerName.Text && x.SellerMobile == txtMobile.Text && x.SellerID != sellerID);
                     if (customerCollection.Count() == 0)
                     {
                         Database.Seller seller = sellerCollection.FirstOrDefault();
                         seller.AccountHolderName = txtAccountHolderName.Text;
                         seller.AccountNo         = txtAccountNo.Text;
                         seller.BankName          = txtBankName.Text;
                         seller.ModifiedBy        = currentUserName;
                         seller.ModifiedDate      = DateTime.Now.Date;
                         seller.IFSCCode          = txtIFSC.Text;
                         seller.SellerAddress     = txtSellerAddress.Text;
                         seller.SellerLandline    = txtLandline.Text;
                         seller.SellerMobile      = txtMobile.Text;
                         seller.SellerName        = txtSellerName.Text;
                         seller.TINNo             = txtTinNo.Text;
                         seller.VATNo             = txtVatNo.Text;
                         seller.SellerEmail       = txtEmail.Text;
                         seller.IsActive          = true;
                         context.SaveChanges();
                         lblMessage.Text      = "Seller Updated Successfully";
                         lblMessage.ForeColor = Color.Green;
                     }
                     else
                     {
                         lblMessage.Text      = "Seller Already Exist Choose Diffrent Name Or Mobile";
                         lblMessage.ForeColor = Color.Red;
                     }
                 }
                 else
                 {
                     lblMessage.Text      = "Seller Not Found";
                     lblMessage.ForeColor = Color.Red;
                 }
             }
             else
             {
                 lblMessage.Text      = "Seller ID Not Valid";
                 lblMessage.ForeColor = Color.Red;
             }
         }
         else
         {
             lblMessage.Text      = "Seller ID Not in right format";
             lblMessage.ForeColor = Color.Red;
         }
     }
     catch (Exception ex)
     {
         Helper.LogError(ex);
         lblMessage.Text      = "Something went Wrong kindly check log";
         lblMessage.ForeColor = Color.Red;
     }
 }