Пример #1
0
 private void btnEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         if (gvGST.FocusedRowHandle >= 0)
         {
             ObjGST         = new GST();
             ObjGST.GSTID   = gvGST.GetFocusedRowCellValue("GSTID");
             ObjGST.GSTCODE = gvGST.GetFocusedRowCellValue("GSTCODE");
             ObjGST.CGST    = gvGST.GetFocusedRowCellValue("CGST");
             ObjGST.SGST    = gvGST.GetFocusedRowCellValue("SGST");
             ObjGST.IGST    = gvGST.GetFocusedRowCellValue("IGST");
             ObjGST.CESS    = gvGST.GetFocusedRowCellValue("CESS");
             frmGST obj = new frmGST(ObjGST);
             obj.ShowInTaskbar        = false;
             obj.StartPosition        = FormStartPosition.CenterScreen;
             obj.IconOptions.ShowIcon = false;
             obj.ShowDialog();
             if (ObjGST.IsSave)
             {
                 gcGST.DataSource = objMasterRep.GetGST();
                 Utility.Setfocus(gvGST, "GSTID", ObjGST.GSTID);
             }
         }
     }
     catch (Exception ex)
     {
         ErrorMgmt.ShowError(ex);
         ErrorMgmt.Errorlog.Error(ex);
     }
 }
        public GST DeleteGST(GST ObjGST)
        {
            int GSTID = 0;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_D_GST]";
                    cmd.Parameters.AddWithValue("@GSTID", ObjGST.GSTID);
                    cmd.Parameters.AddWithValue("@USERID", ObjGST.UserID);
                    object objReturn = cmd.ExecuteScalar();
                    string str       = Convert.ToString(objReturn);
                    if (!int.TryParse(str, out GSTID))
                    {
                        throw new Exception(str);
                    }
                    else
                    {
                        ObjGST.GSTID = objReturn;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Deleteing GST");
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(ObjGST);
        }
Пример #3
0
        protected void ddlType_IndexChanged(object sender, EventArgs e)
        {
            if (txtToDate.Text == "" && txtFromDate.Text == "")
            {
                lblMessage.Text = "Please Select Dates";
                return;
            }

            LoadEmptyGrid();

            lblMessage.Text = string.Empty;
            SqlParameter[] param =
            {
                new SqlParameter("@DealerCode", SqlDbType.Char, 5),           //0
                new SqlParameter("@Type",       SqlDbType.Char, 3),           //0
                new SqlParameter("@FromDate",   SqlDbType.DateTime),          //0
                new SqlParameter("@ToDate",     SqlDbType.DateTime),          //0
            };
            param[0].Value = Session["DealerCode"].ToString();
            param[1].Value = ddlTypes.SelectedValue;
            param[2].Value = sysFunc.SaveDate(txtFromDate.Text);
            param[3].Value = sysFunc.SaveDate(txtToDate.Text);

            ds = ObjGenral.FillDataSet("sp_2W_Service_GetClaimBillingData_new", param);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Grdbillings.DataSource = ds;
                Grdbillings.DataBind();
                Session["JENDetail"] = ds.Tables[0];

                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (GridViewRow gvr in Grdbillings.Rows)
                    {
                        PST         = TotalAmount + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["HandlingAmount"].ToString()) + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["PSTSubletAmount"].ToString()) + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["PSTLaborAmount"].ToString());
                        GST         = TotalAmount + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["GSTAmount"].ToString());
                        TotalAmount = TotalAmount + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["TotalAmount"].ToString());
                        CheckBox Chk = (CheckBox)gvr.Cells[0].FindControl("ChkBox");
                        Chk.Checked = true;
                        //ChkBox.Checked = true;
                    }
                    txtLabPST.Text      = PST.ToString();
                    txtGSTAmt.Text      = GST.ToString();
                    txtTotalAmount.Text = TotalAmount.ToString();
                    //CalculatePSTPercentage();
                }
            }
            else
            {
                //txtPstAmt.Text = "";
                //txtPerc.Text = "";
                lblMessage.Text = "No Record Found !!!";
            }
        }
        public ActionResult New()
        {
            StoreCategory s = new StoreCategory();
            GST           g = new GST();
            UOM           u = new UOM();

            return(View(new StoreInventory()
            {
                StoreGSTs = g.getGSTs(),
                StoreUOMs = u.getUOMs(),
                StoreCategories = s.getCategories(),
                status = 0
            }));
        }
Пример #5
0
 public int Edit(GST model)
 {
     using (IDbConnection connection = OpenConnection(sqlConnString))
     {
         string query        = @"UPDATE GSTRates SET
                         gstName = @gstName
                         ,gstRate = @gstRate
                         ,gstSgstRate = @gstSgstRate
                         ,gstCgstRate = @gstCgstRate
                         ,gstSpRemarks = @gstSpRemarks
                         WHERE gstId = @gstId";
         int    rowsAffected = connection.Execute(query, model);
         return(rowsAffected);
     }
 }
Пример #6
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            ObjGST = new GST();
            frmGST obj = new frmGST(ObjGST);

            obj.ShowInTaskbar        = false;
            obj.StartPosition        = FormStartPosition.CenterScreen;
            obj.IconOptions.ShowIcon = false;
            obj.ShowDialog();
            if (ObjGST.IsSave)
            {
                gcGST.DataSource = objMasterRep.GetGST();
                Utility.Setfocus(gvGST, "GSTID", ObjGST.GSTID);
            }
        }
Пример #7
0
        public ActionResult Delete(decimal id)
        {
            bool Success = false;
            GST  g       = new GST();

            if (g.Delete(id))
            {
                Success = true;
            }
            else
            {
                Success = false;
            }
            return(Json(new { Success = Success }));
        }
        public GST SaveGST(GST ObjGST)
        {
            int GSTID = 0;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_CU_GST]";
                    cmd.Parameters.AddWithValue("@GSTID", ObjGST.GSTID);
                    cmd.Parameters.AddWithValue("@GSTCODE", ObjGST.GSTCODE);
                    cmd.Parameters.AddWithValue("@CGST", ObjGST.CGST);
                    cmd.Parameters.AddWithValue("@SGST", ObjGST.SGST);
                    cmd.Parameters.AddWithValue("@IGST", ObjGST.IGST);
                    cmd.Parameters.AddWithValue("@CESS", ObjGST.CESS);
                    cmd.Parameters.AddWithValue("@USERID", ObjGST.UserID);
                    object objReturn = cmd.ExecuteScalar();
                    string str       = Convert.ToString(objReturn);
                    if (!int.TryParse(str, out GSTID))
                    {
                        throw new Exception(str);
                    }
                    else
                    {
                        ObjGST.GSTID = objReturn;
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("UC_GSTCODE"))
                {
                    throw new Exception("GST Already Exists!!");
                }
                else
                {
                    throw new Exception("Error While Saving GST");
                }
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(ObjGST);
        }
Пример #9
0
        public ActionResult AddGST(GST g)
        {
            bool   Success = false;
            string Message = "";

            if (g.AddGST())
            {
                Success = true;
                Message = "GST Added Successfully";
            }
            else
            {
                Success = false;
                Message = "GST Adding failed";
            }
            return(Json(new { Success = Success, Message = Message }));
        }
Пример #10
0
 public ActionResult Edit(GST model)
 {
     if (ModelState.IsValid)
     {
         int rowsAffected = repo.Edit(model);
         if (rowsAffected > 0)
         {
             TempData["message"] = "Successfully Updated";
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(model));
         }
     }
     return(View(model));
 }
Пример #11
0
 public ActionResult Create(GST model)
 {
     if (ModelState.IsValid)
     {
         int rowsAffected = repo.Create(model);
         if (rowsAffected > 0)
         {
             TempData["message"] = "Successfully Saved";
             return(RedirectToAction("Create"));
         }
         else
         {
             return(View(model));
         }
     }
     return(View(model));
 }
Пример #12
0
 private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         var dlgResult = XtraMessageBox.Show("Are you sure want to delete?", "Confirmation!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         if (Convert.ToString(dlgResult) == "OK" && gvGST.FocusedRowHandle >= 0)
         {
             ObjGST        = new GST();
             ObjGST.GSTID  = gvGST.GetFocusedRowCellValue("GSTID");
             ObjGST.UserID = Utility.UserID;
             objMasterRep.DeleteGST(ObjGST);
             gvGST.DeleteRow(gvGST.FocusedRowHandle);
         }
     }
     catch (Exception ex)
     {
         ErrorMgmt.ShowError(ex);
         ErrorMgmt.Errorlog.Error(ex);
     }
 }
Пример #13
0
        public HttpResponseMessage PostGST([FromBody] GST gst)
        {
            String resp = "{\"Response\":\"Undefine\"}";

            try
            {
                var ctx = new GASEntities();
                ctx.GSTs.Add(gst);
                ctx.SaveChanges();
                resp = "{\"Response\":\"OK\"}";
            }
            catch (Exception ex)
            {
                resp = "{\"Response\":\"Fail\"}";
            }
            var response = Request.CreateResponse(HttpStatusCode.OK);

            response.Content = new StringContent(resp, System.Text.Encoding.UTF8, "application/json");
            return(response);
        }
 private void clear_Click(object sender, EventArgs e)
 {
     Cust_search.Clear();
     CustName.Clear();
     PhoneNumber.Clear();
     Cust_address.Clear();
     custEmail.Clear();
     Product_search.Clear();
     Product_Name.Clear();
     ProductID.Clear();
     Total_Amt.Text = "0";
     SubTotal.Clear();
     Discount.Text = "0";
     GST.Clear();
     PaidAmount.Clear();
     ReturnAmount.Clear();
     Quantity.Text            = "0";
     Amount.Text              = "0";
     AddedProducts.DataSource = null;
 }
Пример #15
0
        public UnitTest1()
        {
            AutoMapper.Mapper.Initialize(cfg =>
            {
                IGST gST = new GST();
                cfg.CreateMap <Expenses, ClaimsDto>()
                .ForMember(dest => dest.costCenter, opt => opt.MapFrom(src => src.CostCenterId))
                .ForMember(dest => dest.date, opt => opt.MapFrom(src => src.TransactionDate))
                .ForMember(dest => dest.total, opt => opt.MapFrom(src => src.TotalAmount))
                .ForMember(dest => dest.gstCalculated, opt => opt.MapFrom(src => gST.CalculateGST(src.TotalAmount)));

                cfg.CreateMap <ClaimsDto, Expenses>()
                .ForMember(dest => dest.CostCenterId, opt => opt.MapFrom(src => src.costCenter))
                .ForMember(dest => dest.TransactionDate, opt => opt.MapFrom(src => src.date))
                .ForMember(dest => dest.CreatedAt, opt => opt.MapFrom(src => DateTime.Now))
                .ForMember(dest => dest.TotalAmount, opt => opt.MapFrom(src => src.total))
                .ForMember(dest => dest.CostCenter, opt => opt.Ignore());
            });

            mockExpenseResult = GetTestSessionExpense();
        }
Пример #16
0
 public int Create(GST model)
 {
     using (IDbConnection connection = OpenConnection(sqlConnString))
     {
         string query        = @"INSERT INTO GSTRates(
                         gstName
                         ,gstRate
                         ,gstSgstRate
                         ,gstCgstRate
                         ,gstSpRemarks)
                         select 
                         @gstName
                         ,@gstRate
                         ,@gstSgstRate
                         ,@gstCgstRate
                         ,@gstSpRemarks";
         int    rowsAffected = connection.Execute(query, model);
         SetIdentity <int>(connection, id => model.gstId = id);
         return(rowsAffected);
     }
 }
Пример #17
0
    protected void btn_selfsubmit_Click(object sender, EventArgs e)
    {
        dv_shipping.Visible = false;

        dv_ship_by_self.Visible = true;
        dv_RCS.Visible          = true;
        lbl_ship_self.Text      = txt_self_ship.Text;
        double a1, b1, c1, i;

        double.TryParse(lbl_ref.Text, out a1);
        double.TryParse(lbl_closingfee.Text, out b1);
        double.TryParse(lbl_ship_self.Text, out c1);

        i            = a1 + b1 + c1;
        lbl_RCS.Text = i.ToString();

        double GST, rcs, gst, per;

        per = 100;
        double.TryParse(lbl_RCS.Text, out rcs);
        double.TryParse(lbl_gst_per.Text, out gst);
        GST          = ((rcs * gst) / per);
        lbl_GST.Text = GST.ToString();

        double total, GST_total;

        double.TryParse(lbl_GST.Text, out GST_total);
        total          = rcs + GST_total;
        lbl_total.Text = total.ToString();

        double prod_price, you_make, profit, cost;

        double.TryParse(txt_prod_price.Text, out prod_price);

        you_make          = prod_price - total;
        lbl_you_make.Text = you_make.ToString();
        double.TryParse(txt_cost.Text, out cost);
        profit = you_make - cost;
    }
Пример #18
0
        public ActionResult getGSTs()
        {
            GST g = new GST();

            return(Json(g.getGSTs(), JsonRequestBehavior.AllowGet));
        }
Пример #19
0
    protected void btn_easy_amazon_Click(object sender, EventArgs e)
    {
        dv_shipping.Visible = false;

        dv_ship_by_budgetok.Visible = true;
        dv_RCS.Visible  = true;
        lbl_weight.Text = txt_weight.Text;
        Double weight, gms, kg5, kg12, gms500u, kg5u, kg12u, ship;

        double.TryParse(lbl_weight.Text, out weight);

        if (rbl_lrn.SelectedValue == "Locally")
        {
            gms     = 40;
            gms500u = 40;
            kg5     = 90;
            kg5u    = 19;
            kg12    = 210;
            kg12u   = 12.50;
            lbl_ship_by_budgetok.Text = "&nbsp;" + rbl_lrn.SelectedValue + "&nbsp;";

            if (weight <= 500)
            {
                lbl_ship.Text = gms.ToString();
            }
            else if (weight >= 501 && weight < 5000)
            {
                double extra = (weight - 500);
                if (extra <= 500)
                {
                    ship          = gms + (gms500u * 1);
                    lbl_ship.Text = ship.ToString();
                }
                else if (extra > 500)
                {
                    double my = (extra / 500);
                    double aa = Math.Ceiling(my);
                    ship          = (gms + (gms500u * aa));
                    lbl_ship.Text = ship.ToString();
                }
            }
            //else if (weight >= 501 && weight <= 1000)
            //{
            //    lbl_ship.Text = (gms + (gms500u * 1)).ToString();
            //}

            //else if (weight >= 1001 && weight <= 1500)
            //{
            //    lbl_ship.Text = (gms + (gms500u * 2)).ToString();
            //}
            //else if (weight >= 1501 && weight <= 2000)
            //{
            //    lbl_ship.Text = (gms + (gms500u * 3)).ToString();
            //}
            //else if (weight >= 2001 && weight <= 3000)
            //{
            //    lbl_ship.Text = (gms + (gms500u * 4)).ToString();
            //}
            //else if (weight >= 3001 && weight <= 4000)
            //{
            //    lbl_ship.Text = (gms + (gms500u * 5)).ToString();
            //}
            //else if (weight >= 4001 && weight < 5000)
            //{
            //    lbl_ship.Text = (gms + (gms500u * 6)).ToString();
            //}
            else if (weight == 5000)
            {
                lbl_ship.Text = kg5.ToString();
            }
            else if (weight >= 5001 && weight < 12000)
            {
                double extra = (weight - 5000);
                if (extra <= 1000)
                {
                    ship          = kg5 + (kg5u * 1);
                    lbl_ship.Text = ship.ToString();
                }
                else if (extra > 1000)
                {
                    double my = (extra / 1000);
                    double aa = Math.Ceiling(my);
                    ship          = (kg5 + (kg5u * aa));
                    lbl_ship.Text = ship.ToString();
                }
            }

            else if (weight == 12000)
            {
                lbl_ship.Text = kg12.ToString();
            }
            else if (weight >= 12000)
            {
                double extra = (weight - 12000);
                if (extra <= 1000)
                {
                    ship          = kg12 + (kg12u * 1);
                    lbl_ship.Text = ship.ToString();
                }
                else if (extra > 1000)
                {
                    double my = (extra / 1000);
                    double aa = Math.Ceiling(my);
                    ship          = (kg12 + (kg12u * aa));
                    lbl_ship.Text = ship.ToString();
                }
            }
        }
        else if (rbl_lrn.SelectedValue == "Regionally")
        {
            gms     = 55;
            gms500u = 45;
            kg5     = 140;
            kg5u    = 21;
            kg12    = 310;
            kg12u   = 15;
            lbl_ship_by_budgetok.Text = "&nbsp;" + rbl_lrn.SelectedValue + "&nbsp;";

            if (weight <= 500)
            {
                lbl_ship.Text = gms.ToString();
            }

            else if (weight >= 501 && weight < 5000)
            {
                double extra = (weight - 500);
                if (extra <= 500)
                {
                    ship          = gms + (gms500u * 1);
                    lbl_ship.Text = ship.ToString();
                }
                else if (extra > 500)
                {
                    double my = (extra / 500);
                    double aa = Math.Ceiling(my);
                    ship          = (gms + (gms500u * aa));
                    lbl_ship.Text = ship.ToString();
                }
            }
            else if (weight == 5000)
            {
                lbl_ship.Text = kg5.ToString();
            }
            else if (weight >= 5001 && weight < 12000)
            {
                double extra = (weight - 5000);
                if (extra <= 1000)
                {
                    ship          = kg5 + (kg5u * 1);
                    lbl_ship.Text = ship.ToString();
                }
                else if (extra > 1000)
                {
                    double my = (extra / 1000);
                    double aa = Math.Ceiling(my);
                    ship          = (kg5 + (kg5u * aa));
                    lbl_ship.Text = ship.ToString();
                }
            }

            else if (weight == 12000)
            {
                lbl_ship.Text = kg12.ToString();
            }
            else if (weight >= 12000)
            {
                double extra = (weight - 12000);
                if (extra <= 1000)
                {
                    ship          = kg12 + (kg12u * 1);
                    lbl_ship.Text = ship.ToString();
                }
                else if (extra > 1000)
                {
                    double my = (extra / 1000);
                    double aa = Math.Ceiling(my);
                    ship          = (kg12 + (kg12u * aa));
                    lbl_ship.Text = ship.ToString();
                }
            }
        }
        else if (rbl_lrn.SelectedValue == "Nationally")
        {
            gms     = 75;
            gms500u = 55;
            kg5     = 190;
            kg5u    = 23;

            lbl_ship_by_budgetok.Text = "&nbsp;" + rbl_lrn.SelectedValue + "&nbsp;";

            if (weight <= 500)
            {
                lbl_ship.Text = gms.ToString();
            }

            else if (weight >= 501 && weight < 5000)
            {
                double extra = (weight - 500);
                if (extra <= 500)
                {
                    ship          = gms + (gms500u * 1);
                    lbl_ship.Text = ship.ToString();
                }
                else if (extra > 500)
                {
                    double my = (extra / 500);
                    double aa = Math.Ceiling(my);
                    ship          = (gms + (gms500u * aa));
                    lbl_ship.Text = ship.ToString();
                }
            }
            else if (weight == 5000)
            {
                lbl_ship.Text = kg5.ToString();
            }
            else if (weight >= 5001 && weight < 12000)
            {
                double extra = (weight - 5000);
                if (extra <= 1000)
                {
                    ship          = kg5 + (kg5u * 1);
                    lbl_ship.Text = ship.ToString();
                }
                else if (extra > 1000)
                {
                    double my = (extra / 1000);
                    double aa = Math.Ceiling(my);
                    ship          = (kg5 + (kg5u * aa));
                    lbl_ship.Text = ship.ToString();
                }
            }
        }
        double a1, b1, c1, i;

        double.TryParse(lbl_ref.Text, out a1);
        double.TryParse(lbl_closingfee.Text, out b1);
        double.TryParse(lbl_ship.Text, out c1);

        i            = a1 + b1 + c1;
        lbl_RCS.Text = i.ToString();

        double GST, rcs, gst, per;

        per = 100;
        double.TryParse(lbl_RCS.Text, out rcs);
        double.TryParse(lbl_gst_per.Text, out gst);
        GST          = ((rcs * gst) / per);
        lbl_GST.Text = GST.ToString();

        double total, GST_total;

        double.TryParse(lbl_GST.Text, out GST_total);
        total          = rcs + GST_total;
        lbl_total.Text = total.ToString();

        double prod_price, you_make, profit, cost;

        double.TryParse(txt_prod_price.Text, out prod_price);

        you_make          = prod_price - total;
        lbl_you_make.Text = you_make.ToString();
        double.TryParse(txt_cost.Text, out cost);
        profit = you_make - cost;
    }
Пример #20
0
        public ActionResult Edit(int?Id)
        {
            GST model = repo.GetGSTRate(Id ?? 0);

            return(View(model));
        }
Пример #21
0
        public ActionResult Create()
        {
            GST model = new GST();

            return(View(model));
        }
        private void Save_Click(object sender, EventArgs e)
        {
            //Create the orders
            try
            {
                Connect connectObj = new Connect();
                con = connectObj.connect();
                SqlCommand cmd = new SqlCommand("Insert into MYORDER (ORD_ID,CID,DATE,AMOUNT) values(@oid,@cid,@date,@amount);", con);

                cmd.Parameters.AddWithValue("@oid", OrderID.Text);
                //cmd.Parameters.AddWithValue("@pid", textBox8.Text);
                cmd.Parameters.AddWithValue("@cid", cid);
                cmd.Parameters.AddWithValue("@date", date.Text);
                cmd.Parameters.AddWithValue("@amount", Total_Amt.Text);

                int i = cmd.ExecuteNonQuery();
                //If count is equal to 1, than show frmMain form
                if (i != 0)
                {
                    MessageBox.Show("Order Insertion Successful!", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Order Insertion Failed", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
            //Insert into orderDetails
            try
            {
                int j;

                Connect connectObj = new Connect();
                con = connectObj.connect();


                for (int i = 0; i < transactionDT.Rows.Count; i++)
                {
                    SqlCommand cmd = new SqlCommand("Insert into ORDER_DETAILS (ord_id,pid,quantity) values(@oid,@pid,@quantity);", con);

                    cmd.Parameters.AddWithValue("@oid", OrderID.Text);
                    cmd.Parameters.AddWithValue("@pid", transactionDT.Rows[i]["Product ID"].ToString());
                    cmd.Parameters.AddWithValue("@quantity", transactionDT.Rows[i]["Quantity"].ToString());


                    j = cmd.ExecuteNonQuery();
                }
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
            //Update stock table after creating order
            try
            {
                int     j;
                Connect connectObj = new Connect();
                con = connectObj.connect();

                for (int i = 0; i < transactionDT.Rows.Count; i++)
                {
                    SqlCommand cmd = new SqlCommand("UPDATE STOCK SET QUANTITY = QUANTITY - @quantity WHERE PID = @pid", con);

                    cmd.Parameters.AddWithValue("@pid", transactionDT.Rows[i]["Product ID"].ToString());
                    cmd.Parameters.AddWithValue("@quantity", transactionDT.Rows[i]["Quantity"].ToString());


                    j = cmd.ExecuteNonQuery();
                }
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }

            //Clear all the fields.
            Cust_search.Clear();
            CustName.Clear();
            PhoneNumber.Clear();
            Cust_address.Clear();
            custEmail.Clear();
            Product_search.Clear();
            Product_Name.Clear();
            ProductID.Clear();
            Total_Amt.Text = "0";
            SubTotal.Clear();
            Discount.Text = "0";
            GST.Clear();
            PaidAmount.Clear();
            ReturnAmount.Clear();
            Quantity.Text            = "0";
            Amount.Text              = "0";
            AddedProducts.DataSource = null;
        }
Пример #23
0
 public frmGST(GST _ObjGST)
 {
     InitializeComponent();
     ObjGST = _ObjGST;
 }