protected void btnSave_Click(object sender, EventArgs e) { try { DataTable dtTest = TMSTelephoneBillDetails.GetSearch(null, Convert.ToInt64(ddlPhone.SelectedValue), ddlMonth.SelectedValue, null, null, null, null, null, null, 1).Tables[0]; if (dtTest.Rows.Count > 0) { dvMsg.Visible = true; lblMessage.Text = "Details Are Already added for this Telephone Number!!!"; dvMsg.Attributes.Add("class", "error_msg"); } else { TMSTelephoneBillDetails objBill = new TMSTelephoneBillDetails(); objBill.TBDBillAmount = Convert.ToInt64(txtBill.Text); objBill.TBDMonth = ddlMonth.SelectedValue; objBill.TBDYear = ddlYear.SelectedValue; objBill.TBDTelephoneId = Convert.ToInt64(ddlPhone.SelectedValue); objBill.TBDAddedById = Convert.ToInt64(Session["UserId"]); objBill.TBDDate = DateTime.Now; objBill.TBDAddedByRemark = "Account Manger"; objBill.TBDStatus = 1; objBill.TBDPaidStatus = "UnPaid"; objBill.Insert(); txtBill.Text = ""; dvMsg.Visible = true; lblMessage.Text = "Telephone Bill Details added Successfully!!!"; dvMsg.Attributes.Add("class", "warring_msg"); BindBillGridview(); } } catch (Exception ex) { } }
protected void grdBillDetails_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { dvMsg.Visible = false; ddlYear1.Visible = false; GridViewRow row = grdBillDetails.Rows[e.RowIndex]; TextBox txtBillAmount = (TextBox)row.FindControl("txtBillAmount"); Label lblBillId = (Label)row.FindControl("lblBillId"); Int64 BillId = Convert.ToInt64(lblBillId.Text); TMSTelephoneBillDetails objBillDetails = TMSTelephoneBillDetails.Get(BillId); if (objBillDetails != null) { objBillDetails.TBDBillAmount = Convert.ToInt64(txtBillAmount.Text); objBillDetails.Update(); BindBillGridview(); grdBillDetails.EditIndex = -1; dvMsg.Visible = true; lblMessage.Text = "Record Updated Successfully"; dvMsg.Attributes.Add("class", "warring_msg"); BindBillGridview(); } } catch (Exception ex) { } }
public static TMSTelephoneBillDetails Get(System.Int64 tbdBillId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSTelephoneBillDetails instance; instance = new TMSTelephoneBillDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSTelephoneBillDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, tbdBillId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSTelephoneBillDetails ID:" + tbdBillId.ToString()+ " from Database."); // Return results. { return(null); } ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
protected void grdBillDetails_RowCommand(object sender, GridViewCommandEventArgs e) { try { string cmdName = e.CommandName.ToString(); if (cmdName == "Edit1") { Int64 BillId = Convert.ToInt64(e.CommandArgument); grdBillDetails.Visible = false; fieldsetAddBill.Visible = true; btnSave.Text = "Update"; TMSTelephoneBillDetails objBillDetails = TMSTelephoneBillDetails.Get(BillId); if (objBillDetails != null) { Int64 TelephoneId = Convert.ToInt64(objBillDetails.TBDTelephoneId); TMSTelephoneDetails obj = TMSTelephoneDetails.Get(TelephoneId); if (obj != null) { ddlType.SelectedValue = obj.TDTelephoneDepartment; BindTelephoneNo(); } ddlPhone.SelectedValue = Convert.ToString(objBillDetails.TBDTelephoneId); txtBill.Text = Convert.ToString(objBillDetails.TBDBillAmount); ddlMonth.SelectedValue = objBillDetails.TBDMonth; ddlYear.SelectedValue = objBillDetails.TBDYear; objBillDetails.Update(); } } } catch (Exception ex) { } }
protected void lnkStatus_Click(object sender, EventArgs e) { try { dvMsg.Visible = false; LinkButton lnk = (LinkButton)sender; GridViewRow grd = (GridViewRow)lnk.NamingContainer; LinkButton lnkStatus = grd.FindControl("lnkStatuss") as LinkButton; TMSTelephoneBillDetails.UpdateBillStatus_MonthandYearWise(Convert.ToInt64(Session["UserId"]), Convert.ToString(lnk.CommandArgument), ddlYear1.SelectedValue); BindTelephoneBill(); } catch (Exception ex) { } }
public static TMSTelephoneBillDetails[] Search(System.Int64?tbdBillId, System.Int64?tbdTelephoneId, System.String tbdMonth, System.String tbdYear, System.Double?tbdBillAmount, System.DateTime?tbdDate, System.Int64?tbdAddedById, System.String tbdAddedByRemark, System.String tbdPaidStatus, System.Int32?tbdStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSTelephoneBillDetails_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, tbdBillId, tbdTelephoneId, tbdMonth, tbdYear, tbdBillAmount, tbdDate, tbdAddedById, tbdAddedByRemark, tbdPaidStatus, tbdStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSTelephoneBillDetails.MapFrom(ds)); }
protected void BindBillGridview() { try { DataTable dtPhoneBillDetails = TMSTelephoneBillDetails.BindTelePhoneBillDetails(Convert.ToInt64(Session["UserId"]), null, null, null, null).Tables[0]; if (dtPhoneBillDetails.Rows.Count > 0) { grdBillDetails.DataSource = dtPhoneBillDetails; grdBillDetails.DataBind(); } else { grdBillDetails.DataSource = null; grdBillDetails.DataBind(); } } catch (Exception ex) { } }
protected void BindTelephoneBill() { try { DataTable dtPhoneBill = TMSTelephoneBillDetails.GetBillDetails_MonthandYearWise(ddlYear1.SelectedValue).Tables[0]; if (dtPhoneBill.Rows.Count > 0) { grdTelephoneBill.DataSource = dtPhoneBill; grdTelephoneBill.DataBind(); } else { grdTelephoneBill.DataSource = null; grdTelephoneBill.DataBind(); } } catch (Exception ex) { } }
private void BindPopUp(string MonthName, string Type) { try { string Month = MonthName; string DeptName = Type; DataTable dtBillDetails = TMSTelephoneBillDetails.BindTelePhoneBillDetails(Convert.ToInt64(Session["UserId"]), null, Month, ddlYear1.SelectedValue, DeptName).Tables[0]; if (dtBillDetails.Rows.Count > 0) { lstPhone.DataSource = dtBillDetails; lstPhone.DataBind(); } else { lstPhone.DataSource = null; lstPhone.DataBind(); } } catch (Exception ex) { } }
public static TMSTelephoneBillDetails[] MapFrom(DataSet ds) { List <TMSTelephoneBillDetails> objects; // Initialise Collection. objects = new List <TMSTelephoneBillDetails>(); // Validation. if (ds == null) { throw new ApplicationException("Cannot map to dataset null."); } else if (ds.Tables[TABLE_NAME].Rows.Count == 0) { return(objects.ToArray()); } if (ds.Tables[TABLE_NAME] == null) { throw new ApplicationException("Cannot find table [dbo].[TMS_TelephoneBillDetails] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_TelephoneBillDetails] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSTelephoneBillDetails instance = new TMSTelephoneBillDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static void Update(TMSTelephoneBillDetails tMSTelephoneBillDetails, DbTransaction transaction) { tMSTelephoneBillDetails.Update(transaction); }
protected void btnSave_Click(object sender, EventArgs e) { try { DataTable dtTest = TMSTelephoneBillDetails.GetSearch(null, Convert.ToInt64(ddlPhone.SelectedValue), ddlMonth.SelectedValue,null,null,null,null,null,null,1).Tables[0]; if (dtTest.Rows.Count > 0) { dvMsg.Visible = true; lblMessage.Text = "Details Are Already added for this Telephone Number!!!"; dvMsg.Attributes.Add("class", "error_msg"); } else { TMSTelephoneBillDetails objBill = new TMSTelephoneBillDetails(); objBill.TBDBillAmount = Convert.ToInt64(txtBill.Text); objBill.TBDMonth = ddlMonth.SelectedValue; objBill.TBDYear = ddlYear.SelectedValue; objBill.TBDTelephoneId = Convert.ToInt64(ddlPhone.SelectedValue); objBill.TBDAddedById = Convert.ToInt64(Session["UserId"]); objBill.TBDDate = DateTime.Now; objBill.TBDAddedByRemark = "Account Manger"; objBill.TBDStatus = 1; objBill.TBDPaidStatus = "UnPaid"; objBill.Insert(); txtBill.Text = ""; dvMsg.Visible = true; lblMessage.Text = "Telephone Bill Details added Successfully!!!"; dvMsg.Attributes.Add("class", "warring_msg"); BindBillGridview(); } } catch (Exception ex) { } }
public static TMSTelephoneBillDetails[] Search(TMSTelephoneBillDetails searchObject) { return Search ( searchObject.TBDBillId, searchObject.TBDTelephoneId, searchObject.TBDMonth, searchObject.TBDYear, searchObject.TBDBillAmount, searchObject.TBDDate, searchObject.TBDAddedById, searchObject.TBDAddedByRemark, searchObject.TBDPaidStatus, searchObject.TBDStatus); }
public static void Update(TMSTelephoneBillDetails tMSTelephoneBillDetails) { tMSTelephoneBillDetails.Update(); }
public static TMSTelephoneBillDetails[] MapFrom(DataSet ds) { List<TMSTelephoneBillDetails> objects; // Initialise Collection. objects = new List<TMSTelephoneBillDetails>(); // Validation. if (ds == null) throw new ApplicationException("Cannot map to dataset null."); else if (ds.Tables[TABLE_NAME].Rows.Count == 0) return objects.ToArray(); if (ds.Tables[TABLE_NAME] == null) throw new ApplicationException("Cannot find table [dbo].[TMS_TelephoneBillDetails] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_TelephoneBillDetails] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSTelephoneBillDetails instance = new TMSTelephoneBillDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSTelephoneBillDetails Get(System.Int64 tbdBillId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSTelephoneBillDetails instance; instance = new TMSTelephoneBillDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSTelephoneBillDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, tbdBillId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSTelephoneBillDetails ID:" + tbdBillId.ToString()+ " from Database."); // Return results. return null; ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }
public static DataSet GetSearch(TMSTelephoneBillDetails searchObject) { return(GetSearch(searchObject.TBDBillId, searchObject.TBDTelephoneId, searchObject.TBDMonth, searchObject.TBDYear, searchObject.TBDBillAmount, searchObject.TBDDate, searchObject.TBDAddedById, searchObject.TBDAddedByRemark, searchObject.TBDPaidStatus, searchObject.TBDStatus)); }