protected void lnkFrwdDelete_Click(object sender, EventArgs e) { int CompanyID = Convert.ToInt32(Session["FrCompanyID"]); LinkButton btn = (LinkButton)sender; TblCompanyAccountDetail objCmpAc = new TblCompanyAccountDetail(CompanyID); ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(btn); TblClientAccount.Delete(TblClientAccount.Columns.Fid, btn.CommandArgument); TblFarwordAmount.Delete(btn.CommandArgument); lblmsg2.Text = MessageBox.Show(msgDiv2, "Record has been deleted!", "alert alert-success alert-icon alert-dismissible", icon, "glyphicon glyphicon-ok-sign"); LoadFrwdAmount(objCmpAc.SerialNo); }
protected void btnEditFamoun_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(btn); Session["FID"] = btn.CommandArgument; TblFarwordAmount obj = new TblFarwordAmount(btn.CommandArgument); ddlCLient.SelectedValue = obj.ClientID.ToString(); txtfrwrdQuantity.Text = obj.Quantity.ToString(); txtfrwrdRate.Text = obj.Rate.ToString(); txtFrwrdAmount.Text = Convert.ToDouble(obj.Quantity * obj.Rate).ToString(); }
protected void lnkDelete_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; TblClientAccount obj = new TblClientAccount(btn.CommandArgument); if (obj.Fid != null) { TblFarwordAmount.Delete(obj.Fid); } TblClientAccount.Delete(btn.CommandArgument); lblmsg.Text = MessageBox.Show(msgDiv, "Record has been deleted!", "alert alert-success alert-icon alert-dismissible", icon, "glyphicon glyphicon-ok-sign"); string id = ddlClientName.SelectedValue; ClearInputs(Page.Controls); ddlClientName.SelectedValue = id; BindGrid(Convert.ToInt32(ddlClientName.SelectedValue)); }
protected void btnFrwrdAmount_Click(object sender, EventArgs e) { #region //TblFarwordAmount obj = new TblFarwordAmount(); //TblClientAccount objClientAcount = new TblClientAccount(); //obj.IsNew = true; //objClientAcount.IsNew = true; //DataTable dt = ExecutePlainQuery("select * from tbl_FarwordAmount where SerialNo=" + hfCompanyID.Value); //if (dt.Rows.Count > 0) //{ // obj.IsNew = false; // objClientAcount.IsNew = false; // obj = new TblFarwordAmount(TblFarwordAmount.Columns.SerialNo, hfCompanyID.Value); //} //obj.Rate = Convert.ToDouble(txtfrwrdRate.Text); //obj.Quantity = Convert.ToDouble(txtfrwrdQuantity.Text); //obj.SerialNo = Convert.ToInt32(hfCompanyID.Value); //obj.ClientID = Convert.ToInt32(ddlCLient.SelectedValue); //obj.Save(); //TblCompanyAccountDetail objCmpAc = new TblCompanyAccountDetail(hfCompanyID.Value); //objClientAcount.Liters = Convert.ToDouble(obj.Quantity); //objClientAcount.Clientid = Convert.ToInt32(ddlCLient.SelectedValue); //objClientAcount.Rate = Convert.ToDecimal(txtfrwrdRate.Text); //objClientAcount.Description = objCmpAc.CategoryID == 1 ? "Forwaded PMG" : "Forwaded HSD"; //objClientAcount.Amount = Convert.ToDecimal(obj.Quantity * obj.Rate); //objClientAcount.Fid = obj.Fid; //objClientAcount.DateX = objCmpAc.DateX; //objClientAcount.Save(); //TblClient objClientName = new TblClient(ddlCLient.SelectedValue); #endregion int CompanyID = Convert.ToInt32(Session["FrCompanyID"]); int FrwdID = Convert.ToInt32(Session["FID"]); TblCompanyAccountDetail objCmpAc = new TblCompanyAccountDetail(CompanyID); TblFarwordAmount obj = new TblFarwordAmount(); TblClientAccount objClientAcount = new TblClientAccount(); string msg = "Amount has been forwaded to " + ddlCLient.SelectedItem.Text; if (Session["FID"] != null) { obj = new TblFarwordAmount(FrwdID); obj.IsNew = false; objClientAcount = new TblClientAccount(TblClientAccount.Columns.Fid, FrwdID); objClientAcount.IsNew = false; msg = "Farwaded amount detail has been updated!"; } obj.Rate = Convert.ToDouble(txtfrwrdRate.Text); obj.Quantity = Convert.ToDouble(txtfrwrdQuantity.Text); obj.SerialNo = Convert.ToInt32(CompanyID); obj.ClientID = Convert.ToInt32(ddlCLient.SelectedValue); obj.CategoryID = objCmpAc.CategoryID; obj.Save(); objClientAcount.Liters = Convert.ToDouble(txtfrwrdQuantity.Text); objClientAcount.Clientid = Convert.ToInt32(ddlCLient.SelectedValue); objClientAcount.Rate = Convert.ToDecimal(txtfrwrdRate.Text); objClientAcount.Description = objCmpAc.CategoryID == 1 ? "Forwaded PMG" : "Forwaded HSD"; objClientAcount.Amount = Convert.ToDecimal(obj.Quantity * obj.Rate); objClientAcount.Fid = obj.Fid; objClientAcount.DateX = Convert.ToDateTime(Convert.ToDateTime(objCmpAc.DateX).ToShortDateString() + " " + getDateTime().ToString("h:mm:ss")); objClientAcount.Save(); lblmsg2.Text = MessageBox.Show(msgDiv2, msg, "alert alert-success alert-icon alert-dismissible", icon, "glyphicon glyphicon-ok-sign"); LoadFrwdAmount(objCmpAc.SerialNo); Session["FID"] = null; //Session["CompanyID"] = null; ClearInputs(Controls); }