protected void btnBillingEdit_Click(object sender, EventArgs e) { String billID = HiddenPlanBillID.Value; int ApplyTo = 0; if (radioall.Checked == true) { ApplyTo = 1; } if (radioselected.Checked == true) { ApplyTo = 0; } //Added by Aarshi on 17 Aug 2017 for code restructuring BillPlan billPlan = new BillPlan(); bool result = billPlan.UpdateSocietyBillPlan(drpchargetype.SelectedItem.Text, txtBillRate.Text, drpbillcycle.SelectedItem.Text, ApplyTo, billID); if (result == true) { LoadSocietyBillPlanData(); lblBillstatus.Text = "Bill Edited Sucessfully"; } else { lblBillstatus.Text = "Bill Edited Failed"; } }
public void LoadSocietyBillPlanData() { try { muser = (User)SessionVariables.User; BillPlan bill = new BillPlan(); DataSet dsBillPlan = bill.GetPlans(muser.currentResident.SocietyID); if (dsBillPlan != null) { if (dsBillPlan.Tables.Count > 0) { BillPlanDataList.DataSource = dsBillPlan; BillPlanDataList.DataBind(); } } else { lblBillPlanStatus.Text = "Received Empty Data"; } } catch (Exception ex) { Utility.log("Load Bill Plans Error " + ex.Message); } }
public void LoadBillTypeDropdown(params DropDownList[] controls) { if (dsBillType == null) { BillPlan billPlan = new BillPlan(); dsBillType = billPlan.GetActiveBillType(muser.currentResident.SocietyID); } if (dsBillType != null) { foreach (ListControl ctrl in controls) { ctrl.Items.Clear(); foreach (DataRow dtRow in dsBillType.Tables[0].Rows) { ctrl.Items.Add(new ListItem(dtRow["BillType"].ToString(), dtRow["BillTypeID"].ToString())); } if (ctrl.ID == "drpCurrentBillType" || ctrl.ID == "drpActivatedBillType" || ctrl.ID == "drpGeneratedBillType") { ctrl.Items.Insert(0, new ListItem("Show All", "NA")); } else { ctrl.Items.Insert(0, new ListItem("Select", "NA")); } } } }
protected void btnSocietyPlanDeactive_Click(object sender, EventArgs e) { String billID = HiddenPlanBillID.Value; String BillType = HiddenPlanBillType.Value; //Added by Aarshi on 17 Aug 2017 for code restructuring BillPlan billPlan = new BillPlan(); billPlan.DeactiveSocietyBillPlan(billID); LoadSocietyBillPlanData(); }
public void LoadBillTypeDropdown(params DropDownList[] controls) { BillPlan billPlan = new BillPlan(); DataSet dsBillType = billPlan.GetActiveBillType(muser.currentResident.SocietyID); if (dsBillType != null) { drpGenBillForOnLatest.DataSource = dsBillType; drpGenBillForOnLatest.DataTextField = "BillType"; drpGenBillForOnLatest.DataValueField = "BillTypeID"; drpGenBillForOnLatest.DataBind(); } }
protected void drpAddBillType_SelectedIndexChanged(object sender, EventArgs e) { //Added by Aarshi on 17 Aug 2017 for code restructuring BillPlan billPlan = new BillPlan(); int BillID = billPlan.GetBillID(drpAddBillType.SelectedItem.Text); if (BillID == 0) { lblBillCheck.Text = ""; } else { lblBillCheck.Text = "Bill Type already Exists"; } }
protected void btnPlanSubmit_Click(object sender, EventArgs e) { DataAccess dacess = new DataAccess(); int ApplyTo = 1; try { if (radioall.Checked == true) { ApplyTo = 1; } if (radioselected.Checked == true) { ApplyTo = 0; } // DateTime date = System.DateTime.Now; DateTime date = Utility.GetCurrentDateTimeinUTC(); String ChargeType = drpchargetype.SelectedItem.Text; String CycleType = drpbillcycle.SelectedItem.Text; BillPlan billPlan = new BillPlan(); muser = (User)SessionVariables.User; bool result = billPlan.AddSocietyBillPlan(Convert.ToInt32(drpAddBillType.SelectedValue.ToString()), drpAddBillType.SelectedItem.Text, ChargeType, txtBillRate.Text, CycleType, ApplyTo, muser.currentResident.SocietyID); if (result) { LoadSocietyBillPlanData(); LoadBillData(); } else { lblBillstatus.Text = "Failed to Add Bill Plan, Please try later."; } } catch (Exception ex) { lblBillstatus.Text = ex.Message; } }
protected void BillsUploadSubmit_Click(object sender, EventArgs e) { OleDbConnection Connection = null; try { int countCalulatedBill = 0; int countInActiveBill = 0; if (BillsUpload.PostedFile.FileName == "") { lblmessage.Text = "Please Select a file."; return; } String strTime = Utility.GetCurrentDateTimeinUTC().ToLongTimeString(); strTime = strTime.ToString().Replace(':', '-'); string path = strTime + "-" + BillsUpload.PostedFile.FileName; String Extension = Path.GetExtension(BillsUpload.PostedFile.FileName); path = Server.MapPath(Path.Combine("~/Data/", path)); BillsUpload.SaveAs(path); String Connectionstring = String.Empty; switch (Extension) { case ".xls": Connectionstring = ConfigurationManager.ConnectionStrings["Excel03ConString"].ConnectionString; // Connectionstring = ConfigurationManager.ConnectionStrings["Excel07conString"].ConnectionString; break; case ".xlsx": Connectionstring = ConfigurationManager.ConnectionStrings["Excel07conString"].ConnectionString; break; } Connectionstring = String.Format(Connectionstring, path); //Session["Path"] = path; //Added by Aarshi on 18 auh 2017 for session storage SessionVariables.Path = path; Connection = new OleDbConnection(Connectionstring); Connection.Open(); String insertQuery = "select * from [Sheet1$]"; OleDbDataAdapter adp = new OleDbDataAdapter(insertQuery, Connection); DataTable DataExcel = new DataTable(); adp.Fill(DataExcel); if (DataExcel.Rows.Count > 0) { foreach (DataRow ExcelRow in DataExcel.Rows) { try { int previousBillTypeID = 0; SocietyBillPlan socBillPlan = new SocietyBillPlan(); int FlatID = Convert.ToInt32(ExcelRow["FlatID"]); String FlatNumber = ExcelRow["FlatNumber"].ToString(); int BillTypeID = Convert.ToInt32(ExcelRow["BillTypeID"]); String BillType = ExcelRow["BillType"].ToString(); DateTime BillStartDate = Convert.ToDateTime(ExcelRow["BillStartDate"]); DateTime BillEndDate = Convert.ToDateTime(ExcelRow["BillEndDate"]); DateTime PaymentDueDate = Convert.ToDateTime(ExcelRow["PaymentDueDate"]); int PreviousMonthBalance = Convert.ToInt32(ExcelRow["PreviousMonthBalance"]); int CurrentBillAmount = Convert.ToInt32(ExcelRow["CurrentBillAmount"]); DateTime BillMonth = Convert.ToDateTime(ExcelRow["BillMonth"]); int billResID = Convert.ToInt32(ExcelRow["ResID"]); if (BillTypeID != previousBillTypeID) { BillPlan billPlan = new BillPlan(); socBillPlan = billPlan.GetPlan(BillTypeID, SocietyID); } previousBillTypeID = BillTypeID; tableGeneratedBill.Rows.Add(FlatID, FlatNumber, BillTypeID, BillType, BillStartDate, BillEndDate, PaymentDueDate, PreviousMonthBalance, CurrentBillAmount, socBillPlan.SocietyBillID, socBillPlan.CycleType, "Bulk Import", DateTime.Today.Date, SocietyID, "Import", 2, billResID, baseDate); countCalulatedBill = countCalulatedBill + 1; } catch (Exception ex) { countInActiveBill = countInActiveBill + 1; } } if (countCalulatedBill == 0) { lblmessage.Text = countCalulatedBill + " Bill calculated. " + countInActiveBill + " Bill not in date range"; } else { lblmessage.Text = countCalulatedBill + " Bill calculated. " + countInActiveBill + " Bill not in date range"; NewGeneratedBill.DataSource = tableGeneratedBill; NewGeneratedBill.DataBind(); ClientScript.RegisterStartupScript(this.GetType(), "alert('')", "ShowGenerateBillPreview()", true); } } else { //lblNewvalues.Visible = false; //NewValueScroll_Div.Visible = false; } //Ends here } catch (Exception ex) { lblmessage.Text = "Please check the file and data format. Error Detail: ex.Message"; //lblNewvalues.Visible = false; //NewValueScroll_Div.Visible = false; String message = ex.Message; } finally { if (Connection != null) { if (Connection.State == ConnectionState.Open) { Connection.Close(); } Connection = null; } } }
protected void btnBillcycleSubmit_Click(object sender, EventArgs e)//Activated Bill { DataAccess dacess = new DataAccess(); Double Amount = 0; String Description = ""; Double PrevBalance = 0; String billType = HiddenField2.Value; //Added by Aarshi on 17 Aug 2017 for code restructuring BillPlan billPlan = new BillPlan(); int billid = billPlan.GetBillID(billType); String CycleStart = txtCyclestart.Text; String CycleEnD = txtCycleend.Text; String ChargeType = HiddenFieldChargeType.Value; DateTime Date = Utility.GetCurrentDateTimeinUTC(); String CycleType = labelcycletype.Text; String Rate = labelRate.Text; String FlatNumber = lblFlatNumber.Text; //Added by Aarshi on 17 Aug 2017 for code restructuring BillCycle billCycle = new BillCycle(); // int ID = billCycle.GetFlatID(FlatNumber); int ID = Convert.ToInt32(FlatNumber); int count = 0; if (ID != 0) { DateTime startdate = DateTime.ParseExact(CycleStart, "dd-MM-yyyy", null); DateTime enddate = DateTime.ParseExact(CycleEnD, "dd-MM-yyyy", null); //BillCycle billCycle = new BillCycle(); // Bill.ActivateBillForFlat(Convert.ToInt32(billid), FlatNumber, Convert.ToDateTime(CycleStart), Convert.ToDateTime(CycleEnD)); // bool result = true; // = billCycle.AddSingleFlatBillCycle(Convert.ToInt32(billid), FlatNumber, Convert.ToDateTime(startdate), Convert.ToDateTime(enddate), "Activate Bill"); GenerateBill genBill = new GenerateBill(); genBill.AmountTobePaid = Convert.ToInt32(Rate); genBill.AmountPaid = 0; genBill.AmountPaidDate = DateTime.Now; genBill.BillDescription = Description; genBill.BillEndDate = enddate; genBill.BillMonth = enddate; genBill.BillTypeID = 5; genBill.BillStartDate = DateTime.UtcNow; genBill.CurrentBillAmount = 500; genBill.ActionType = "Activate"; genBill.Activated = 1; genBill.CycleType = "Quaterly"; genBill.FlatID = ID; genBill.InvoiceID = ""; genBill.ModifiedAt = DateTime.UtcNow; genBill.PaymentDueDate = DateTime.UtcNow.AddDays(7); genBill.PaymentMode = ""; genBill.PreviousMonthBalance = 0; genBill.SocietyBillID = 2; genBill.SocietyID = 1; genBill.TransactionID = ""; genBill.op_BillType = ""; Bill bill = new Bill(); //bool isInserted = bill.InsertNewBillPay(genBill); /* if (result) * { * // count = Bill.InsertFirstZeroBill(FlatNumber, billid, CycleType, CycleStart); * }*/ } else { lblbilltypeexist.Text = FlatNumber + " is Not Exist with this Society"; } if (count == 1) { lblbilltypeexist.Text = "Bill Generated Sucessfully"; } else { lblbilltypeexist.Text = "Bill Generated Failed"; } LoadActivatedBill(); }