Пример #1
0
        public static string[] ValidateQuantity(decimal enterdQuantity, int productid, int purchaseId)
        {
            string[] isfail = new string[2];
            isfail[0] = "false";
            isfail[1] = "";
            IMS_TESTEntities context = new IMS_TESTEntities();

            // int purchaseId = Convert.ToInt32(hdnPurchaseId.Value);
            try
            {
                if (enterdQuantity != 0 && productid != 0)
                {
                    if (companyId != 0 && purchaseId != 0)
                    {
                        SqlHelper helper        = new SqlHelper();
                        var       stockQuantity = context.tbl_stock.Where(s => s.company_id == companyId && s.product_id == productid).FirstOrDefault();

                        var returnQuantity = context.GetReturnQuantity(purchaseId, Constants.Purchase, productid, companyId).FirstOrDefault();
                        if (enterdQuantity <= returnQuantity)
                        {
                            if (stockQuantity.qty < Convert.ToDecimal(enterdQuantity))
                            {
                                isfail[0] = "true";
                                //lblcheckDoubleError.Visible = true;
                                isfail[1] = "Insufficient stock quantity.";
                                return(isfail);
                            }
                        }
                        else
                        {
                            if (stockQuantity.qty <= returnQuantity)
                            {
                                isfail[0] = "true";
                                //lblcheckDoubleError.Visible = true;
                                isfail[1] = "Only " + stockQuantity.qty + " can be return for the selected product, Since some of item sold.";
                                return(isfail);
                            }
                            else
                            {
                                isfail[0] = "true";
                                //lblcheckDoubleError.Visible = true;
                                isfail[1] = "Only " + returnQuantity + " can be return for the selected product.";
                                return(isfail);
                            }
                        }
                    }
                }
                else
                {
                    isfail[0] = "true";
                    //lblcheckDoubleError.Visible = true;
                    isfail[1] = "Please select product or enter correct return quantity.";
                    return(isfail);
                }

                //pass false as default if not true
                isfail[0] = "false";
            }
            catch (Exception ex)
            {
                ErrorLog.saveerror(ex);
            }
            return(isfail);
        }
Пример #2
0
        protected void Save()
        {
            try
            {
                int purchaseId = Convert.ToInt32(hdnPurchaseId.Value);
                if (purchaseId == 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openalert('Please Enter Purchase No','False');", true);
                    return;
                }
                //Get Origianl Purchase Details
                tbl_purchase purchase = new tbl_purchase();
                purchase = context.tbl_purchase.Where(pd => pd.purchase_id == purchaseId && pd.company_id == companyId && pd.branch_id == branchId).FirstOrDefault();

                tbl_purchasereturn purchaseReturn = new tbl_purchasereturn();
                purchaseReturn.purchase_id      = purchaseId;
                purchaseReturn.company_id       = companyId;
                purchaseReturn.branch_id        = branchId;
                purchaseReturn.financialyear_id = financialYearId;
                purchaseReturn.InvoiceNumber    = txtPoNo.Text;
                purchaseReturn.paymentmode_id   = Convert.ToInt32(ddlPaymentMode.SelectedValue);
                purchaseReturn.status           = true;
                purchaseReturn.party_id         = Convert.ToInt32(purchase.party_id);
                purchaseReturn.created_by       = user_id;
                purchaseReturn.created_date     = DateTime.Now;

                //Update into Purchase Payment Details
                tbl_PurchasePaymentDetials purchasePaymentDetail = context.tbl_PurchasePaymentDetials.Where(w => w.PurchaseId == purchaseId).FirstOrDefault();
                purchasePaymentDetail.PaidAmnt       = Convert.ToDecimal(txtPaidAmt.Text);
                purchasePaymentDetail.GivenAmnt      = Convert.ToDecimal(lblGivenAmnt.Text) - Convert.ToDecimal(txtPaidAmt.Text);
                purchasePaymentDetail.BalanceAmnt    = Convert.ToDecimal(txtBalanceAmt.Text);
                purchasePaymentDetail.TaxAmount      = Convert.ToDecimal(lblResultTotalTaxAmnt.Text);
                purchasePaymentDetail.DiscountAmount = Convert.ToDecimal(lblResultTotalDiscount.Text);
                purchasePaymentDetail.SubTotal       = Convert.ToDecimal(lblResultSubTotal.Text);
                purchasePaymentDetail.GrandTotal     = Convert.ToDecimal(lblResultGrndTotal.Text);
                purchasePaymentDetail.FromTable      = "Return";
                purchase.tbl_PurchasePaymentDetials.Add(purchasePaymentDetail);

                for (int i = 0; i <= gvpurchasedetails.Rows.Count - 1; i++)
                {
                    int         productId = Convert.ToInt32(gvpurchasedetails.Rows[i].Cells[2].Text);
                    int         batchId   = Convert.ToInt32(gvpurchasedetails.Rows[i].Cells[4].Text);
                    tbl_product product   = context.tbl_product.Where(w => w.product_id == productId).FirstOrDefault();

                    tbl_purchasereturndetails purchaseReturnDetails = new tbl_purchasereturndetails();
                    purchaseReturnDetails.product_id    = productId;
                    purchaseReturnDetails.batch_id      = batchId;
                    purchaseReturnDetails.tax_id        = product.tax_id;
                    purchaseReturnDetails.unit_id       = product.unit_id;
                    purchaseReturnDetails.discount_amnt = Convert.ToDecimal(gvpurchasedetails.Rows[i].Cells[7].Text);
                    purchaseReturnDetails.tax_amt       = gvpurchasedetails.Rows[i].Cells[9].Text;
                    purchaseReturnDetails.quantity      = Convert.ToInt32(gvpurchasedetails.Rows[i].Cells[5].Text);
                    purchaseReturnDetails.amount        = Convert.ToDecimal(gvpurchasedetails.Rows[i].Cells[10].Text);
                    purchaseReturnDetails.created_by    = Convert.ToString(user_id);
                    purchaseReturnDetails.created_date  = Convert.ToDateTime(DateTime.Now);
                    purchaseReturnDetails.status        = true;

                    tbl_stock stock = new tbl_stock();
                    stock               = context.tbl_stock.Where(w => w.company_id == companyId && w.branch_id == branchId && w.product_id == productId && w.batch_id == batchId).FirstOrDefault();
                    stock.qty           = stock.qty - Convert.ToInt32(gvpurchasedetails.Rows[i].Cells[5].Text);
                    stock.modified_by   = Convert.ToString(user_id);
                    stock.modified_date = Convert.ToDateTime(DateTime.Now);

                    purchaseReturn.tbl_purchasereturndetails.Add(purchaseReturnDetails);
                }

                context.tbl_purchasereturn.Add(purchaseReturn);
                context.SaveChanges();
                string invoiceNumber = purchaseReturn.InvoiceNumber;
                ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openalert('saved Successfully, You order number is " + invoiceNumber + "','True');", true);
            }
            catch (Exception ex)
            {
                ErrorLog.saveerror(ex);
            }
        }
Пример #3
0
        //public void ddlcategorybind()
        //{

        //    List<tbl_category> cd = context.tbl_category.Where(x => x.status == true && x.company_id == companyId && x.branch_id == branchId).ToList();
        //    ddlCategory.DataTextField = "category_name";
        //    ddlCategory.DataValueField = "category_id";
        //    ddlCategory.DataSource = cd;
        //    ddlCategory.DataBind();
        //    ddlCategory.Items.Insert(0, new ListItem("--Select Category--", "0"));
        //}
        //public void ddlunitbind()
        //{
        //    List<tbl_unit> cd = context.tbl_unit.Where(x => x.status == true && x.company_id == companyId && x.branch_id == branchId).ToList();
        //    ddlUnit.DataTextField = "unit_name";
        //    ddlUnit.DataValueField = "unit_id";
        //    ddlUnit.DataSource = cd;
        //    ddlUnit.DataBind();
        //    ddlUnit.Items.Insert(0, new ListItem("--Select Unit--", "0"));
        //}

        //public void ddlgodownbind()
        //{
        //    List<tbl_godown> gd = context.tbl_godown.Where(x => x.status == true && x.company_id == companyId && x.branch_id == branchId).ToList();

        //    ddlGodown.DataTextField = "godown_name";
        //    ddlGodown.DataValueField = "godown_id";
        //    ddlGodown.DataSource = gd;
        //    ddlGodown.DataBind();
        //    ddlGodown.Items.Insert(0, new ListItem("--Select Godown--", "0"));
        //}
        //public void ddlrackbind(int godownid)
        //{
        //    int g_id = Convert.ToInt32(ddlGodown.SelectedValue);
        //    List<tbl_rack> cd = context.tbl_rack.Where(x => x.status == true && x.company_id == companyId && x.branch_id == branchId && x.godown_id==godownid).ToList();
        //    ddlRack.DataTextField = "rack_name";
        //    ddlRack.DataValueField = "rack_id";
        //    ddlRack.DataSource = cd;
        //    ddlRack.DataBind();
        //    ddlRack.Items.Insert(0, new ListItem("--Select Rack--", "0"));
        //    if (cd.Count == 0)
        //    {
        //        lblrackerror.Text = "No rack found ";
        //    }
        //    else
        //    {
        //        lblrackerror.Text = string.Empty;
        //    }
        //}
        //public void ddltaxbind()
        //{
        //    List<tbl_taxgroup> cd = context.tbl_taxgroup.Where(x => x.status == true && x.company_id == companyId && x.branch_id == branchId).ToList();
        //    dataTable = ToDataTable(cd);
        //    ddlTaxgroup.DataTextField = "group_name";
        //    ddlTaxgroup.DataValueField = "group_id";
        //    ddlTaxgroup.DataSource = cd;
        //    ddlTaxgroup.DataBind();
        //}

        //private void savedcode()
        //{
        //    try
        //    {
        //        if (hd.Value == "false")
        //        {
        //            if (hde.Value == "false")
        //            {
        //                Label1.Text = String.Empty;
        //                lblcheckDoubleError.Text = String.Empty;
        //                tbl_product product = new tbl_product();
        //                product.company_id = companyId;
        //                product.branch_id = branchId;
        //                product.category_id = Int32.Parse(ddlCategory.SelectedValue);
        //                product.unit_id = Int32.Parse(ddlUnit.SelectedValue);
        //                product.godown_id = Int32.Parse(ddlGodown.SelectedValue);
        //                product.rack_id = Int32.Parse(ddlRack.SelectedValue);
        //                //product.tax_id = Int32.Parse(ddlTax.SelectedValue);
        //                product.product_name = txtProductName.Text;
        //                product.product_code = txtProductCode.Text;
        //                product.hsn_code = txtHSNCode.Text;
        //                product.reorder_level = Int32.Parse(txtReorderqty.Text);
        //                product.purchas_price = decimal.Parse(txtPurchasePrice.Text);
        //                product.sales_price = decimal.Parse(txtSalesPrice.Text);
        //                product.created_by = User_id;
        //                product.created_date = DateTime.Today;
        //                product.status = true;
        //                product.modified_by = "";
        //                product.modified_date = null;
        //                ////Shakeeb
        //                ////pd.Insert(pd);
        //                //Entity Framework Saving Awais

        //                foreach (ListItem item in ddlTaxgroup.Items)
        //                {

        //                    if (item.Selected)
        //                    {
        //                        tbl_productTaxGroup productTax = new tbl_productTaxGroup();
        //                        productTax.group_id = Convert.ToInt32(item.Value);
        //                        productTax.isSelected = true;
        //                        product.tbl_productTaxGroup.Add(productTax);
        //                    }

        //                }

        //                context.tbl_product.Add(product);
        //                context.SaveChanges();
        //                loadDataTable();
        //                clr();
        //                divalert.Visible = true;
        //                lblAlert.Text = "Product Saved Successfully ";



        //                //context.tbl_product.Add(pd);
        //                //context.SaveChanges();
        //            }
        //            else
        //            {
        //                divalert.Visible = false;
        //                lblcheckDoubleError.ForeColor = System.Drawing.Color.Red;
        //                lblcheckDoubleError.Text = "This Product Code name already Exists";
        //            }

        //        }
        //        else
        //        {
        //            divalert.Visible = false;
        //            Label1.ForeColor = System.Drawing.Color.Red;
        //            Label1.Text = "This Product name already Exists";
        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //        ErrorLog.saveerror(ex);
        //        //Do Logging
        //    }
        //}

        //private void updatecode()
        //{
        //    try
        //    {
        //        if (hd.Value != "true")
        //        {
        //            if (hde.Value != "true")
        //            {
        //                Label1.Text = string.Empty;
        //                lblcheckDoubleError.Text = String.Empty;
        //                GridViewRow row = GridView1.SelectedRow;
        //                int product_id = Convert.ToInt32(ViewState["productId"]);
        //                decimal sales_price = decimal.Parse(txtSalesPrice.Text);
        //                decimal purchase_price = decimal.Parse(txtPurchasePrice.Text);
        //                int cat_id = Int32.Parse(ddlCategory.SelectedValue);
        //                int unit_id = Int32.Parse(ddlUnit.SelectedValue);
        //                int godown_id = Int32.Parse(ddlGodown.SelectedValue);
        //                int rack_id = Int32.Parse(ddlRack.SelectedValue);
        //                //int tax_id = Int32.Parse(ddlTax.SelectedValue);

        //                //context.sp_UpdateProduct(companyId, branchId, product_id, cat_id, rack_id, godown_id, tax_id, unit_id, orderlevel, purchase_price, sales_price, txtProductCode.Text, txtHSNCode.Text, txtProductName.Text, User_id, DateTime.Today);

        //                var product = context.tbl_product.Where(w => w.product_id == product_id).FirstOrDefault();
        //                product.product_name = txtProductName.Text;
        //                product.product_code = txtProductCode.Text;
        //                product.hsn_code = txtHSNCode.Text;
        //                product.purchas_price = decimal.Parse(txtPurchasePrice.Text);
        //                product.reorder_level = Convert.ToInt32(txtReorderqty.Text);
        //                product.sales_price = decimal.Parse(txtSalesPrice.Text);
        //                product.rack_id = rack_id;
        //                product.category_id = cat_id;
        //                product.godown_id = godown_id;

        //                //Delete Existing Mapping and add new mapping for product and tax group
        //                //var tbl_productTaxGroup = new tbl_productTaxGroup { product_id = product_id};
        //                //context.tbl_productTaxGroup.Attach(tbl_productTaxGroup);
        //                //context.tbl_productTaxGroup.Remove(tbl_productTaxGroup);
        //                //context.SaveChanges();
        //                foreach (var grpType in context.tbl_productTaxGroup.Where(w => w.product_id == product_id).ToList())
        //                {
        //                    product.tbl_productTaxGroup.Remove(grpType);
        //                }

        //                for (int i = 0; i < ddlTaxgroup.Items.Count; i++)
        //                {


        //                    if (ddlTaxgroup.Items[i].Selected)
        //                    {

        //                        tbl_productTaxGroup productTaxGroup = new tbl_productTaxGroup();
        //                        ListItem item = ddlTaxgroup.Items[i];
        //                        int groupId = int.Parse(ddlTaxgroup.Items[i].Value);
        //                        productTaxGroup.product_id = product_id;
        //                        productTaxGroup.group_id = groupId;
        //                        product.tbl_productTaxGroup.Add(productTaxGroup);
        //                    }
        //                }


        //                product.unit_id = unit_id;
        //                product.modified_by = User_id;
        //                product.modified_date = DateTime.Now;


        //                context.SaveChanges();



        //                btnUpdate.Visible = false;
        //                btnSave.Visible = true;
        //                divalert.Visible = true;
        //                clr();
        //                loadDataTable();
        //                lblAlert.Text = "Product Updated Successfully ";
        //            }
        //            else
        //            {
        //                divalert.Visible = false;
        //                lblcheckDoubleError.ForeColor = System.Drawing.Color.Red;
        //                lblcheckDoubleError.Text = "This Product Code name already Exists";
        //            }
        //        }
        //        else
        //        {
        //            divalert.Visible = false;
        //            Label1.ForeColor = System.Drawing.Color.Red;
        //            Label1.Text = "This Product Name already Exists";
        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //        ErrorLog.saveerror(ex);
        //        //Do Logging
        //    }
        //}

        //public void clr()
        //{
        //    txtHSNCode.Text = string.Empty;
        //    txtProductCode.Text = string.Empty;
        //    txtProductName.Text = string.Empty;
        //    txtPurchasePrice.Text = string.Empty;
        //    txtReorderqty.Text = string.Empty;
        //    txtSalesPrice.Text = string.Empty;
        //    ddlCategory.SelectedIndex = 0;
        //    ddlGodown.SelectedIndex = 0;
        //    ddlRack.SelectedIndex = 0;
        //    ddlTaxgroup.SelectedIndex = 0;
        //    ddlUnit.SelectedIndex = 0;
        //}

        #endregion
        /// <summary>
        /// All The Events That are used in coding
        /// </summary>

        #region Events
        //protected void btnSave_Click(object sender, EventArgs e)
        //{
        //    //savedcode();
        //}


        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //Label1.Text = String.Empty;
                //lblcheckDoubleError.Text = String.Empty;
                GridViewRow row       = GridView1.SelectedRow;
                int         productId = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);

                Session["productId"]  = productId;
                ctrlProduct.productid = productId.ToString();



                ctrlProduct.purchprice   = Convert.ToDecimal(row.Cells[3].Text);
                ctrlProduct.saleprice    = Convert.ToDecimal(row.Cells[2].Text);
                ctrlProduct.productname  = row.Cells[0].Text;
                ctrlProduct.productcode  = row.Cells[4].Text;
                ctrlProduct.HSNcode      = row.Cells[10].Text;
                ctrlProduct.reorderlevel = Convert.ToInt32(row.Cells[5].Text);
                //int taxId = GridView1.SelectedIndex;
                ctrlProduct.categoryid = Convert.ToInt32(row.Cells[6].Text);
                ctrlProduct.unitid     = Convert.ToInt32(row.Cells[9].Text);
                ctrlProduct.godownid   = Convert.ToInt32(row.Cells[7].Text);
                ctrlProduct.rackid     = Convert.ToInt32(row.Cells[8].Text);
                // ddlTax.SelectedValue = (row.Cells[13].Text);

                List <tbl_taxgroup> cd = context.tbl_taxgroup.Where(x => x.status == true && x.company_id == companyId && x.branch_id == branchId).ToList();
                dataTable = ToDataTable(cd);
                List <string> taxgroup = new List <string>();
                if (productId != 0)
                {
                    List <tbl_productTaxGroup> selectedItem = context.tbl_productTaxGroup.Where(p => p.product_id == productId).ToList();
                    DataTable dt = ToDataTable(selectedItem);
                    if (dataTable != null)
                    {
                        for (int i = 0; i < dataTable.Rows.Count; i++)
                        {
                            for (int j = 0; j < dt.Rows.Count; j++)
                            {
                                int groupID = Convert.ToInt32(dt.Rows[j]["group_id"]);
                                // var value = //ddlTaxgroup.Items.FindByValue((dataTable.Rows[i]["group_id"]).ToString());
                                int group_id = Convert.ToInt32(dataTable.Rows[i]["group_id"]);
                                if (group_id == groupID)
                                {
                                    taxgroup.Add(groupID.ToString());
                                    //taxgroup.Items[j].Value = groupID.ToString();
                                    //taxgroup.Items[i].Selected = true;
                                    break;
                                }
                            }
                        }
                    }
                    ctrlProduct.Taxdropdown.DataSource = taxgroup;
                    //ctrlProduct.Taxdropdown.DataBind();
                }



                //btnSave.Visible = false;
                //btnUpdate.Visible = true;
                divalert.Visible = false;
                //ddlCategory.Focus();
                //hde.Value = string.Empty;
                //hd.Value = string.Empty;
            }
            catch (Exception ex)
            {
                ErrorLog.saveerror(ex);
                //Do Logging
            }
        }
Пример #4
0
        //public void Test(string PageName)
        //{
        //    try
        //    {
        //        if (PageName == "Product")
        //        {
        //            ifm.Attributes.Add("src", "../Masters/Product.aspx");
        //        }
        //        ifm.Visible = true;
        //        //ifm.Attributes.Add("src", "../Masters/Product.aspx");
        //        //main.Visible = false;
        //        bMaster.Visible = true;
        //    }
        //    catch (Exception ex)
        //    {
        //        ErrorLog.saveerror(ex);
        //    }

        //}
        public void F_yearcheck()
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TestDBConnection"].ConnectionString);
            SqlCommand    cmd = new SqlCommand();

            cmd.CommandText    = "sp_last15daysf_year";
            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.Connection     = con;
            cmd.CommandTimeout = 600000;
            con.Open();
            var mcid      = 0;
            int end_days  = 0;
            int days_flag = 0;
            int c_id      = Convert.ToInt32(Session["company_id"]);

            try
            {
                if (c_id != 0)
                {
                    cmd.Parameters.AddWithValue("@company_id", c_id);
                    cmd.Parameters.Add("@days_flag", SqlDbType.Int);
                    cmd.Parameters["@days_flag"].Direction = ParameterDirection.Output;
                    cmd.Parameters.Add("@enddays_flag", SqlDbType.Int);
                    cmd.Parameters["@enddays_flag"].Direction = ParameterDirection.Output;
                    cmd.Parameters.AddWithValue("@s_date", "2018-05-15 18:47:00");
                    cmd.Parameters.Add("@days_left", SqlDbType.Int);
                    cmd.Parameters["@days_left"].Direction = ParameterDirection.Output;
                    cmd.ExecuteNonQuery();
                    if (!(cmd.Parameters["@days_left"].Value is DBNull))
                    {
                        mcid = Convert.ToInt32(cmd.Parameters["@days_left"].Value);
                    }
                    if (!(cmd.Parameters["@enddays_flag"].Value is DBNull))
                    {
                        end_days = Convert.ToInt32(cmd.Parameters["@enddays_flag"].Value);
                    }
                    if (!(cmd.Parameters["@days_flag"].Value is DBNull))
                    {
                        days_flag = Convert.ToInt32(cmd.Parameters["@days_flag"].Value);
                    }
                    if (days_flag == 1)
                    {
                        Session["mcid"] = 1;
                        Session["days"] = mcid;
                        //msg.Visible = true;
                        //notify.Visible = true;
                        //lblnotification.Text = "1";
                        // lblF_year.Text = "Your Current Financial Year Is Ending In "  + mcid+ " Day's";
                        //ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openalert('Your Current Financial Year Is Ending In  Days','False');", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.saveerror(ex);
            }
            finally
            {
                if (con != null && con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }
Пример #5
0
        private void savedcode()
        {
            try
            {
                if (hd.Value == "false")
                {
                    if (hde.Value == "false")
                    {
                        Label1.Text = String.Empty;
                        lblcheckDoubleError.Text = String.Empty;
                        tbl_product product = new tbl_product();
                        product.company_id    = companyId;
                        product.branch_id     = branchId;
                        product.category_id   = Int32.Parse(ddlCategory.SelectedValue);
                        product.unit_id       = Int32.Parse(ddlUnit.SelectedValue);
                        product.godown_id     = Int32.Parse(ddlGodown.SelectedValue);
                        product.rack_id       = Int32.Parse(ddlRack.SelectedValue);
                        product.tax_id        = Int32.Parse(ddlTax.SelectedValue);
                        product.product_name  = txtProductName.Text;
                        product.product_code  = txtProductCode.Text;
                        product.hsn_code      = txtHSNCode.Text;
                        product.reorder_level = Int32.Parse(txtReorderqty.Text);
                        product.purchas_price = decimal.Parse(txtPurchasePrice.Text);
                        product.sales_price   = decimal.Parse(txtSalesPrice.Text);
                        product.created_by    = User_id;
                        product.created_date  = DateTime.Today;
                        product.status        = true;
                        product.modified_by   = "";
                        product.modified_date = null;
                        ////Shakeeb
                        ////pd.Insert(pd);
                        //Entity Framework Saving Awais
                        context.tbl_product.Add(product);
                        context.SaveChanges();
                        loadDataTable();
                        clr();
                        divalert.Visible = true;
                        lblAlert.Text    = "Product Saved Successfully ";



                        //context.tbl_product.Add(pd);
                        //context.SaveChanges();
                    }
                    else
                    {
                        divalert.Visible = false;
                        lblcheckDoubleError.ForeColor = System.Drawing.Color.Red;
                        lblcheckDoubleError.Text      = "This Product Code name already Exists";
                    }
                }
                else
                {
                    divalert.Visible = false;
                    Label1.ForeColor = System.Drawing.Color.Red;
                    Label1.Text      = "This Product name already Exists";
                }
            }
            catch (Exception ex)
            {
                ErrorLog.saveerror(ex);
                //Do Logging
            }
        }