Beispiel #1
0
        protected void lnkDelete_Click(object sender, EventArgs e)
        {
            LinkButton btn = (LinkButton)sender;

            string[] values  = btn.CommandArgument.Split(',');
            TblTank  objTank = new TblTank(TblTank.Columns.Catagoryid, values[2]);

            if (values[1] == "0")//Loss
            {
                objTank.Quantity += Convert.ToDouble(values[3]);
            }
            else//Gain
            {
                objTank.Quantity -= Convert.ToDouble(values[3]);
            }
            objTank.Save();
            TblTankGainLoss.Delete(values[0]);
            lblmsg.Text = MessageBox.Show(msgDiv, "Data has been deleted!", "alert alert-success alert-icon alert-dismissible", icon, "glyphicon glyphicon-ok-sign");
            BindData();
        }
Beispiel #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            TblTankGainLoss obj = new TblTankGainLoss();

            obj.CategoryID = Convert.ToInt32(ddlCatagory.SelectedValue);
            obj.Type       = Convert.ToInt32(ddlType.SelectedValue);
            obj.Qty        = Convert.ToDecimal(txtQTY.Text);
            obj.DateX      = Convert.ToDateTime(Convert.ToDateTime(txtDate.SelectedDate).ToShortDateString() + " " + getDateTime().ToString("h:mm:ss"));
            obj.Save();
            TblTank objTank = new TblTank(TblTank.Columns.Catagoryid, obj.CategoryID);

            if (ddlType.SelectedValue == "0")//Loss
            {
                objTank.Quantity -= Convert.ToInt32(obj.Qty);
            }
            else//Gain
            {
                objTank.Quantity += Convert.ToInt32(obj.Qty);
            }
            objTank.Save();
            lblmsg.Text = MessageBox.Show(msgDiv, "Data has been added!", "alert alert-success alert-icon alert-dismissible", icon, "glyphicon glyphicon-ok-sign");
            BindData();
        }