Exemplo n.º 1
0
        protected void linkbtnEdit_Click(object sender, EventArgs e)
        {
            LinkButton  lb = (LinkButton)sender;
            GridViewRow gr = (GridViewRow)lb.NamingContainer;

            ViewState["id"] = ((Label)gr.FindControl("labelNOTICE_ID")).Text;
            string      nid = ViewState["id"].ToString();
            ITEM_MASTER cm  = ITEM_MASTER.GetByITEM_ID(int.Parse(nid));

            txtitemName.Text = cm.ITEMNAME;


            dropCategory.SelectedValue = cm.CATEGORY_ID.ToString(); /*fillCategory(); fillSubCategory();*/
            dropSubCate.SelectedValue  = cm.SubCategory_ID.ToString();


            txtitemCode.Text = cm.CODE;
            txthsnCode.Text  = cm.HSNCODE;
            //  dropUnit.SelectedIndex = cm.UNIT_ID;
            txtCGST.Text        = cm.CGST.ToString();
            txtSGST.Text        = cm.SGST.ToString();
            txtIGST.Text        = cm.IGST.ToString();
            txtDescription.Text = cm.Description;
            txtstock.Text       = cm.OPEN_STOCK.ToString();
            btnsubmit.Text      = "Update";
        }
Exemplo n.º 2
0
        protected void ddlItem_SelectedIndexChanged(object sender, EventArgs e)
        {
            int ItemId = int.Parse(ddlItem.SelectedValue);

            txtItemCode.Text = ITEM_MASTER.GetByITEM_ID(ItemId).CODE;
            txtrate.Text     = ITEM_MASTER.GetByITEM_IDRATE(ItemId).Price.ToString();
        }
Exemplo n.º 3
0
        public void Form_detail(int ItemId)
        {
            try
            {
                ITEM_MASTER cm = ITEM_MASTER.GetByITEM_ID(ItemId);
                if (cm.ITEM_ID > 0)
                {
                    ViewState["MID"] = ItemId;
                    txtitemName.Text = cm.ITEMNAME;
                    int SubId = cm.SubCategory_ID;

                    dropCategory.SelectedValue = SubCategoryMaster.GetByCategory_ID(SubId).Category_ID.ToString();
                    fillSubCategory();
                    dropSubCate.SelectedValue = cm.SubCategory_ID.ToString();
                    BindUnit();
                    txtitemCode.Text    = cm.CODE;
                    txthsnCode.Text     = cm.HSNCODE;
                    txtCGST.Text        = cm.CGST.ToString();
                    txtSGST.Text        = cm.SGST.ToString();
                    txtIGST.Text        = cm.IGST.ToString();
                    txtDescription.Text = cm.Description;
                    txtstock.Text       = cm.OPEN_STOCK.ToString();
                    if (cm.Image == "" || cm.Image == null)
                    {
                        Image.ImageUrl = "~/images/b1.jpg";
                    }
                    else
                    {
                        Image.ImageUrl = "~/images/ItemImages/" + cm.Image;
                    }
                    if (cm.Image1 == "" || cm.Image1 == null)
                    {
                        Image1.ImageUrl = "~/images/b1.jpg";
                    }
                    else
                    {
                        Image1.ImageUrl = "~/images/ItemImages/" + cm.Image1;
                    }
                    if (cm.Image2 == "" || cm.Image2 == null)
                    {
                        Image2.ImageUrl = "~/images/b1.jpg";
                    }
                    else
                    {
                        Image2.ImageUrl = "~/images/ItemImages/" + cm.Image2;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        protected void linkbtnEdit_Click(object sender, EventArgs e)
        {
            LinkButton  lb = (LinkButton)sender;
            GridViewRow gr = (GridViewRow)lb.NamingContainer;

            ViewState["id"] = ((Label)gr.FindControl("labelNOTICE_ID")).Text;
            string      nid = ViewState["id"].ToString();
            ITEM_MASTER dm  = ITEM_MASTER.GetByITEM_ID(int.Parse(nid));

            //txtcolor.Text = dm.Color_NAME;
            //txtremark.Text = dm.REMARK;
            btnsubmit.Text = "Update";
        }
Exemplo n.º 5
0
        protected void linkbtnEdit_Click(object sender, EventArgs e)
        {
            LinkButton  lb = (LinkButton)sender;
            GridViewRow gr = (GridViewRow)lb.NamingContainer;

            ViewState["id"] = ((Label)gr.FindControl("labelNOTICE_ID")).Text;
            string      nid = ViewState["id"].ToString();
            OrderMaster dm  = OrderMaster.GetByOrderId(int.Parse(nid));

            ddlItem.SelectedIndex = dm.ITEM_ID;
            txtItemCode.Text      = ITEM_MASTER.GetByITEM_ID(ddlItem.SelectedIndex).CODE;
            numqty.Text           = dm.QUANTITY.ToString();
            txtrate.Text          = dm.RATE_PER.ToString();
            btnsubmit.Text        = "Update";
        }
 public void Member_detail(int MID)
 {
     try
     {
         string      Color = dropcolor.SelectedValue;
         string      Unit  = dropSize.SelectedValue;
         ITEM_MASTER drms  = ITEM_MASTER.GetByITEM_ID(MID);
         if (drms.ITEM_ID > 0)
         {
             #region
             ViewState["MID"]    = MID;
             lblItemName.Text    = drms.ITEMNAME;
             lblprice.Text       = ITEM_MASTER.GetByITEM_IDRATE(MID).Price.ToString();// txtrate.Text = ITEM_MASTER.GetByITEM_IDRATE(ItemId).Price.ToString();
             lblDescription.Text = drms.Description;
             if (string.IsNullOrWhiteSpace(drms.Image))
             {
                 ImageOneUrl = "../images/NoImage";
             }
             else
             {
                 ImageOneUrl = "../images/ItemImages/" + drms.Image;
             }
             if (string.IsNullOrWhiteSpace(drms.Image1))
             {
                 ImageTwoUrl = "../images/NoImage";
             }
             else
             {
                 ImageTwoUrl = "../images/ItemImages/" + drms.Image1;
             }
             if (string.IsNullOrWhiteSpace(drms.Image2))
             {
                 ImageThreeUrl = "../images/NoImage";
             }
             else
             {
                 ImageThreeUrl = "../images/ItemImages/" + drms.Image2;
             }
             #endregion
         }
     }
     catch (Exception ex)
     {
         string script = "<script>alert('" + ex.Message + "');</script>";
     }
 }
 protected void ListView2_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "QuickView")
         {
             int         CollectID = Convert.ToInt32(e.CommandArgument);
             ITEM_MASTER rg        = ITEM_MASTER.GetByITEM_ID(CollectID);
             if (rg.ITEM_ID > 0)
             {
                 Response.Redirect("productdetail.aspx?st=" + rg.ITEM_ID);
             }
         }
     }
     catch (Exception ex)
     { string script = "<script>alert('" + ex.Message + "');</script>"; }
 }
Exemplo n.º 8
0
        protected void linkbtnEdit_Click(object sender, EventArgs e)
        {
            LinkButton  lb = (LinkButton)sender;
            GridViewRow gr = (GridViewRow)lb.NamingContainer;

            ViewState["id"] = ((Label)gr.FindControl("labelNOTICE_ID")).Text;
            string nid = ViewState["id"].ToString();
            ProductInvoice_Master dm = ProductInvoice_Master.GetByINVOICE_ID(int.Parse(nid));

            ddlItem.SelectedValue = dm.ITEM_ID.ToString();
            txtItemCode.Text      = ITEM_MASTER.GetByITEM_ID(ddlItem.SelectedIndex).CODE;
            txtcgst.Text          = dm.CGST_RATE.ToString();
            txtsgst.Text          = dm.SGST_RATE.ToString();
            txtigst.Text          = dm.IGST_RATE.ToString();
            numqty.Text           = dm.QUANTITY.ToString();
            txtrate.Text          = dm.RATE_PER.ToString();
            btnsave.Text          = "Update";
        }
Exemplo n.º 9
0
 protected void linkbtnEdit_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton  lb     = (LinkButton)sender;
         GridViewRow gv     = (GridViewRow)lb.NamingContainer;
         int         FileId = int.Parse(((Label)gv.FindControl("labelNOTICE_ID")).Text);
         ITEM_MASTER rg     = ITEM_MASTER.GetByITEM_ID(FileId);
         if (rg.ITEM_ID > 0)
         {
             Response.Redirect("frmItemMaster.aspx?st=" + rg.ITEM_ID);
         }
     }
     catch (Exception ex)
     {
         string script = "<script>alert('" + ex.Message + "');</script>";
     }
 }
Exemplo n.º 10
0
 public void fillCategory()
 {
     try
     {
         List <ITEM_MASTER> _state = ITEM_MASTERCollection.GetAll();
         ITEM_MASTER        sm     = new ITEM_MASTER();
         sm.ITEM_ID  = 0;
         sm.ITEMNAME = "-select Category-";
         _state.Insert(0, sm);
         ddlItem.DataSource     = _state;
         ddlItem.DataTextField  = "ITEMNAME";
         ddlItem.DataValueField = "ITEM_ID";
         ddlItem.DataBind();
     }
     catch (Exception ex)
     {
         string script = "<script>alert('" + ex.Message + "');</script>";
     }
 }
Exemplo n.º 11
0
 protected void ddlItem_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (ddlItem.SelectedIndex > 0)
         {
             if (ddlUser.SelectedIndex > 0)
             {
                 int ItemId = int.Parse(ddlItem.SelectedValue);
                 int User   = ddlUser.SelectedIndex;
                 txtItemCode.Text = ITEM_MASTER.GetByITEM_ID(ItemId).HSNCODE;
                 txtrate.Text     = ITEM_MASTER.GetByITEM_IDRATE(ItemId).Price.ToString();
                 int UserState  = USERPROFILEMASTER.GetByRegistration_ID(User).State;
                 int PicUpState = PickupMaster.GetByPickupID(int.Parse(Session["PickupID"].ToString())).State;
                 if (UserState == PicUpState)
                 {
                     txtigst.Text = "0";
                     txtcgst.Text = ITEM_MASTER.GetByITEM_ID(ItemId).CGST.ToString();
                     txtsgst.Text = ITEM_MASTER.GetByITEM_ID(ItemId).SGST.ToString();
                 }
                 else
                 {
                     txtcgst.Text = "0";
                     txtsgst.Text = "0";
                     txtigst.Text = ITEM_MASTER.GetByITEM_ID(ItemId).IGST.ToString();
                 }
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Plz Select User');</Script>", false);
                 ddlUser.Focus();
                 return;
             }
         }
         else
         {
             txtcgst.Text = "0";
             txtsgst.Text = "0";
             txtigst.Text = "0";
         }
     }
     catch (Exception ew) { }
 }
Exemplo n.º 12
0
 protected void linkbtnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton  lb = (LinkButton)sender;
         GridViewRow gv = (GridViewRow)lb.NamingContainer;
         ViewState["id"] = ((Label)gv.FindControl("labelNOTICE_ID")).Text;
         string      did = ViewState["id"].ToString();
         ITEM_MASTER dm  = new ITEM_MASTER();
         dm.ITEM_ID = int.Parse(did);
         dm.Delete();
         ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Data Delete....');</Script>", false);
         Response.Redirect("frmItemList.aspx");
         grid();
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('" + ex.Message + "');</Script>", false);
     }
 }
Exemplo n.º 13
0
 protected void ddlItem_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (ddlItem.SelectedIndex > 0)
         {
             int ItemId = int.Parse(ddlItem.SelectedValue);
             txtItemCode.Text = ITEM_MASTER.GetByITEM_ID(ItemId).HSNCODE;
             txtrate.Text     = ITEM_MASTER.GetByITEM_IDRATE(ItemId).Price.ToString();
             txtcgst.Text     = ITEM_MASTER.GetByITEM_ID(ItemId).CGST.ToString();
             txtsgst.Text     = ITEM_MASTER.GetByITEM_ID(ItemId).SGST.ToString();
             txtigst.Text     = ITEM_MASTER.GetByITEM_ID(ItemId).IGST.ToString();
         }
         else
         {
             txtcgst.Text = "0";
             txtsgst.Text = "0";
             txtigst.Text = "0";
         }
     }
     catch (Exception ew) { }
 }
Exemplo n.º 14
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     try
     {
         decimal maxrateigst      = 0;
         decimal total            = 0;
         ProductInvoice_Master ln = new ProductInvoice_Master();
         total = decimal.Parse(numqty.Text) * decimal.Parse(txtrate.Text.Trim());
         if (btnsave.Text == "Submit")
         {
             if (string.IsNullOrEmpty(numqty.Text))
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Plz Enter Quantity..');</Script>", false);
                 numqty.Focus();
                 return;
             }
             else
             {
                 decimal qt = decimal.Parse(numqty.Text.Trim());
                 if (qt <= 0)
                 {
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Quantity must be greater than zero..');</Script>", false);
                     numqty.Focus();
                     return;
                 }
             }
             ln.INVOICE_ID = ProductInvoice_Master.MaxId() + 1;
             ln.ITEM_ID    = int.Parse(ddlItem.SelectedValue);
             ln.ITEMNAME   = ITEM_MASTER.GetByITEM_ID(ln.ITEM_ID).ITEMNAME;
             ln.HSNCODE    = ITEM_MASTER.GetByITEM_ID(ln.ITEM_ID).HSNCODE;
             ln.QUANTITY   = decimal.Parse(numqty.Text);
             ln.RATE_PER   = decimal.Parse(txtrate.Text.Trim());
             ln.TOTAL      = total;
             decimal cgst = decimal.Parse(txtcgst.Text.Trim());
             decimal sgst = decimal.Parse(txtsgst.Text.Trim());
             decimal igst = decimal.Parse(txtigst.Text.Trim());
             if (cgst > maxrate)
             {
                 maxrate = cgst;
             }
             if (sgst > maxrate)
             {
                 maxrate = sgst;
             }
             if (igst > maxrate)
             {
                 maxrate = igst;
             }
             maxrateigst     = maxrate;
             ln.CGST_AMT     = (total * cgst) / 100;
             ln.SGST_AMT     = (total * sgst) / 100;
             ln.IGST_AMT     = (total * igst) / 100;
             ln.CGST_RATE    = cgst;
             ln.SGST_RATE    = sgst;
             ln.IGST_RATE    = igst;
             ln.BILL_ID      = billid;
             ln.REMARKS      = "";
             ln.INVOICE_DATE = System.DateTime.Today;
             ln.Bil_Stutas   = "Waiting";
             ln.Save();
         }
         else if (btnsave.Text == "Update")
         {
             ln            = ProductInvoice_Master.GetByINVOICE_ID(int.Parse(ViewState["id"].ToString()));
             ln.INVOICE_ID = int.Parse(ViewState["id"].ToString());
             ln.ITEM_ID    = int.Parse(ddlItem.SelectedValue);
             ln.ITEMNAME   = ITEM_MASTER.GetByITEM_ID(ln.ITEM_ID).ITEMNAME;
             ln.HSNCODE    = ITEM_MASTER.GetByITEM_ID(ln.ITEM_ID).HSNCODE;
             ln.QUANTITY   = decimal.Parse(numqty.Text);
             ln.RATE_PER   = decimal.Parse(txtrate.Text.Trim());
             ln.TOTAL      = total;
             decimal cgst = decimal.Parse(txtcgst.Text.Trim());
             decimal sgst = decimal.Parse(txtsgst.Text.Trim());
             decimal igst = decimal.Parse(txtigst.Text.Trim());
             if (cgst > maxrate)
             {
                 maxrate = cgst;
             }
             if (sgst > maxrate)
             {
                 maxrate = sgst;
             }
             if (igst > maxrate)
             {
                 maxrate = igst;
             }
             maxrateigst     = maxrate;
             ln.CGST_AMT     = (total * cgst) / 100;
             ln.SGST_AMT     = (total * sgst) / 100;
             ln.IGST_AMT     = (total * igst) / 100;
             ln.CGST_RATE    = cgst;
             ln.SGST_RATE    = sgst;
             ln.IGST_RATE    = igst;
             ln.BILL_ID      = billid;
             ln.REMARKS      = "";
             ln.INVOICE_DATE = System.DateTime.Today;
             ln.Bil_Stutas   = "Waiting";
             ln.Save();
             ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Update Successfully...');</Script>", false);
         }
         grid();
         ddlItem.SelectedIndex = 0;
         ClearControls(this);
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert(error);</script>", false);
     }
 }
 protected void btnsubmit_Click(object sender, EventArgs e)
 {
     try
     {
         NewCollectionMaster cm = new NewCollectionMaster();
         if (btnsubmit.Text == "Submit")
         {
             cm.NewCollection_ID = NewCollectionMaster.MaxId() + 1;
             cm.ITEM_ID          = 1;
             cm.ITEMNAME         = txtitemName.Text;
             cm.CATEGORY_ID      = int.Parse(dropCategory.SelectedValue.ToString());
             cm.SubCategory_ID   = int.Parse(dropSubCate.SelectedValue.ToString());
             cm.Description      = txtDescription.Text.Trim();
             cm.DiscountPrice    = decimal.Parse(txtdiscountPrice.Text);
             cm.Price            = decimal.Parse(txtprice.Text);
             #region Image1
             string exten = System.IO.Path.GetExtension(fileImage.FileName);
             if (fileImage.HasFile == true)
             {
                 fileImage.SaveAs(Server.MapPath("~/images/ItemImages/" + cm.ITEMNAME + 1 + exten));
                 cm.Image = cm.ITEMNAME + 1 + exten;
             }
             else
             {
                 cm.Image = ITEM_MASTER.GetByITEM_ID(cm.ITEM_ID).Image;
             }
             #endregion
             cm.Save();
             grid();
             ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Submit Successfully....');</Script>", false);
         }
         else if (btnsubmit.Text == "Update")
         {
             cm = NewCollectionMaster.GetByNewCollection_ID(int.Parse(ViewState["id"].ToString()));
             cm.NewCollection_ID = int.Parse(ViewState["id"].ToString());
             cm.ITEM_ID          = 1;
             cm.ITEMNAME         = txtitemName.Text;
             cm.CATEGORY_ID      = int.Parse(dropCategory.SelectedValue.ToString());
             cm.SubCategory_ID   = int.Parse(dropSubCate.SelectedValue.ToString());
             cm.Description      = txtDescription.Text.Trim();
             cm.DiscountPrice    = decimal.Parse(txtdiscountPrice.Text);
             cm.Price            = decimal.Parse(txtprice.Text);
             #region Image1
             string exten = System.IO.Path.GetExtension(fileImage.FileName);
             if (fileImage.HasFile == true)
             {
                 fileImage.SaveAs(Server.MapPath("~/images/ItemImages/" + cm.ITEMNAME + 1 + exten));
                 cm.Image = cm.ITEMNAME + 1 + exten;
             }
             else
             {
                 cm.Image = ITEM_MASTER.GetByITEM_ID(cm.ITEM_ID).Image;
             }
             #endregion
             grid();
             ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Update Successfully...');</Script>", false);
         }
         ClearInputs(Page.Controls);
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert(error);</script>", false);
     }
 }
Exemplo n.º 16
0
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            try
            {
                ITEM_MASTER   cm     = new ITEM_MASTER();
                string        constr = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
                SqlConnection cn     = new SqlConnection(constr);

                if (btnsubmit.Text == "Submit")
                {
                    if (!ValidateItemControls())
                    {
                        return;
                    }
                    SqlCommand cmd = new SqlCommand("usp_SaveItemMaster", cn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    if (Request.QueryString["st"] == null)
                    {
                        cmd.Parameters.AddWithValue("@ITEM_ID", 0);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@ITEM_ID", Request.QueryString["st"]);
                    }
                    cmd.Parameters.AddWithValue("@ITEMNAME", txtitemName.Text);
                    cmd.Parameters.AddWithValue("@SubCategory_ID", dropSubCate.SelectedValue);
                    cmd.Parameters.AddWithValue("@CODE", txtitemCode.Text);
                    cmd.Parameters.AddWithValue("@HSNCODE", txthsnCode.Text);
                    cmd.Parameters.AddWithValue("@CGST", txtCGST.Text);
                    cmd.Parameters.AddWithValue("@SGST", txtSGST.Text);
                    cmd.Parameters.AddWithValue("@IGST", txtIGST.Text);
                    cmd.Parameters.AddWithValue("@Description", txtDescription.Text);
                    cmd.Parameters.AddWithValue("@OPEN_STOCK", txtstock.Text);
                    #region Image1
                    string exten = System.IO.Path.GetExtension(fileImage.FileName);
                    if (fileImage.HasFile == true)
                    {
                        fileImage.SaveAs(Server.MapPath("~/images/ItemImages/" + txtitemName.Text + 1 + exten));
                        string Image = txtitemName.Text + 1 + exten;
                        cmd.Parameters.AddWithValue("@Image", Image);
                    }
                    #endregion
                    #region Image2
                    string exten1 = System.IO.Path.GetExtension(fileImage1.FileName);
                    if (fileImage1.HasFile == true)
                    {
                        fileImage1.SaveAs(Server.MapPath("~/images/ItemImages/" + txtitemName.Text + 2 + exten1));
                        string Image1 = txtitemName.Text + 2 + exten1;
                        cmd.Parameters.AddWithValue("@Image1", Image1);
                    }
                    #endregion
                    #region Image3
                    string exten2 = System.IO.Path.GetExtension(fileImage2.FileName);
                    if (fileImage2.HasFile == true)
                    {
                        fileImage2.SaveAs(Server.MapPath("~/images/ItemImages/" + txtitemName.Text + 3 + exten2));
                        string Image3 = txtitemName.Text + 3 + exten2;
                        cmd.Parameters.AddWithValue("@Image2", Image3);
                    }
                    #endregion
                    cmd.Parameters.AddWithValue("@ItemUnits", GetUnitsDT());
                    cn.Open();
                    cmd.ExecuteNonQuery();
                    cn.Close();
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Submit Successfully....');</Script>", false);
                }
                else if (btnsubmit.Text == "Save Change")
                {
                    SqlCommand cmd = new SqlCommand("usp_SaveItemMaster", cn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    if (Request.QueryString["st"] == null)
                    {
                        cmd.Parameters.AddWithValue("@ITEM_ID", 0);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@ITEM_ID", Request.QueryString["st"]);
                    }
                    cmd.Parameters.AddWithValue("@ITEMNAME", txtitemName.Text);
                    cmd.Parameters.AddWithValue("@SubCategory_ID", dropSubCate.SelectedValue);
                    cmd.Parameters.AddWithValue("@CODE", txtitemCode.Text);
                    cmd.Parameters.AddWithValue("@HSNCODE", txthsnCode.Text);
                    cmd.Parameters.AddWithValue("@CGST", txtCGST.Text);
                    cmd.Parameters.AddWithValue("@SGST", txtSGST.Text);
                    cmd.Parameters.AddWithValue("@IGST", txtIGST.Text);
                    cmd.Parameters.AddWithValue("@Description", txtDescription.Text);
                    cmd.Parameters.AddWithValue("@OPEN_STOCK", txtstock.Text);
                    #region Image1
                    string exten = System.IO.Path.GetExtension(fileImage.FileName);
                    if (fileImage.HasFile == true)
                    {
                        fileImage.SaveAs(Server.MapPath("~/images/ItemImages/" + txtitemName.Text + 1 + exten));
                        string Image = txtitemName.Text + 1 + exten;
                        cmd.Parameters.AddWithValue("@Image", Image);
                    }
                    #endregion
                    #region Image2
                    string exten1 = System.IO.Path.GetExtension(fileImage1.FileName);
                    if (fileImage1.HasFile == true)
                    {
                        fileImage1.SaveAs(Server.MapPath("~/images/ItemImages/" + txtitemName.Text + 2 + exten1));
                        string Image1 = txtitemName.Text + 2 + exten1;
                        cmd.Parameters.AddWithValue("@Image1", Image1);
                    }
                    #endregion
                    #region Image3
                    string exten2 = System.IO.Path.GetExtension(fileImage2.FileName);
                    if (fileImage2.HasFile == true)
                    {
                        fileImage2.SaveAs(Server.MapPath("~/images/ItemImages/" + txtitemName.Text + 3 + exten2));
                        string Image3 = txtitemName.Text + 3 + exten2;
                        cmd.Parameters.AddWithValue("@Image2", Image3);
                    }
                    #endregion
                    cmd.Parameters.AddWithValue("@ItemUnits", GetUnitsDT());
                    cn.Open();
                    cmd.ExecuteNonQuery();
                    cn.Close();
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Update Successfully...');</Script>", false);
                }
                Response.Redirect("frmItemList.aspx");
                ClearInputs(Page.Controls);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert(error);</script>", false);
            }
        }
Exemplo n.º 17
0
 protected void btnsubmit_Click(object sender, EventArgs e)
 {
     try
     {
         decimal          total = 0;
         PickUpItemMaster ln    = new PickUpItemMaster();
         total = decimal.Parse(numqty.Text) * decimal.Parse(txtrate.Text.Trim());
         if (btnsubmit.Text == "Submit")
         {
             if (string.IsNullOrEmpty(numqty.Text))
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Plz Enter Quantity..');</Script>", false);
                 numqty.Focus();
                 return;
             }
             else
             {
                 decimal qt = decimal.Parse(numqty.Text.Trim());
                 if (qt <= 0)
                 {
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Quantity must be greater than zero..');</Script>", false);
                     numqty.Focus();
                     return;
                 }
             }
             ln.Id        = PickUpItemMaster.GetMaxID() + 1;
             ln.ITEM_ID   = int.Parse(ddlItem.SelectedValue);
             ln.ITEMNAME  = ITEM_MASTER.GetByITEM_ID(int.Parse(ddlItem.SelectedValue)).ITEMNAME;
             ln.HSNCODE   = txtItemCode.Text;
             ln.CGST      = int.Parse(txtcgst.Text);
             ln.SGST      = int.Parse(txtsgst.Text);
             ln.IGST      = int.Parse(txtigst.Text);
             ln.QUANTITY  = decimal.Parse(numqty.Text);
             ln.RATE_PER  = decimal.Parse(txtrate.Text.Trim());
             ln.TOTAL     = total;
             ln.EntryDate = System.DateTime.Today;
             ln.PickupID  = int.Parse(Session["PickupID"].ToString());
             ln.Save();
             ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Submit Successfully...');</Script>", false);
         }
         else if (btnsubmit.Text == "Update")
         {
             ln           = PickUpItemMaster.GetByOrderId(int.Parse(ViewState["id"].ToString()));
             ln.Id        = int.Parse(ViewState["id"].ToString());
             ln.ITEM_ID   = ddlItem.SelectedIndex;
             ln.QUANTITY  = decimal.Parse(numqty.Text);
             ln.RATE_PER  = decimal.Parse(txtrate.Text.Trim());
             ln.TOTAL     = total;
             ln.EntryDate = System.DateTime.Today;
             ln.PickupID  = int.Parse(Session["PickupID"].ToString());
             ln.Save();
             ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Update Successfully...');</Script>", false);
         }
         grid();
         ClearControls(this);
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert(error);</script>", false);
     }
 }