public static TMSFacultyType Get(System.Int64 ftFacultyId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSFacultyType instance; instance = new TMSFacultyType(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSFacultyType_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, ftFacultyId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSFacultyType ID:" + ftFacultyId.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSFacultyType[] Search(System.Int64?ftFacultyId, System.String ftFacultyName, System.DateTime?ftDate, System.Int32?ftStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSFacultyType_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, ftFacultyId, ftFacultyName, ftDate, ftStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSFacultyType.MapFrom(ds)); }
public static TMSFacultyType[] MapFrom(DataSet ds) { List <TMSFacultyType> objects; // Initialise Collection. objects = new List <TMSFacultyType>(); // 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_FacultyType] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_FacultyType] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSFacultyType instance = new TMSFacultyType(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSFacultyType[] Search(TMSFacultyType searchObject) { return(Search(searchObject.FTFacultyId, searchObject.FTFacultyName, searchObject.FTDate, searchObject.FTStatus)); }
public static void Update(TMSFacultyType tMSFacultyType, DbTransaction transaction) { tMSFacultyType.Update(transaction); }
public static void Update(TMSFacultyType tMSFacultyType) { tMSFacultyType.Update(); }
protected void btnsave_Click(object sender, EventArgs e) { try { Int64 FacultyTypeId = Convert.ToInt64(Session["FacultyType"]); TMSFacultyType objType = TMSFacultyType.Get(FacultyTypeId); string FacultyType = null; if (objType != null) { FacultyType = objType.FTFacultyName; } if (btnsave.Text == "Update") { TMSSalaryDetails objSalary = TMSSalaryDetails.Get(Convert.ToInt64(HiddenSalaryId.Value)); objSalary.SIFacultyLoginId = Convert.ToInt64(Session["AccountID"]); if (rbtmonth.Checked == true) { objSalary.SISalaryType = "Monthly"; } else if (rbtYear.Checked == true) { objSalary.SISalaryType = "Yearly"; } objSalary.SIFacultyType = Session["FacultyType"].ToString(); objSalary.SIFacultyType = Session["FacultyType"].ToString(); // objSalary.SIGrossSalary = float.Parse(txtGrossSalary.Text); objSalary.SILeaveCount = Convert.ToInt32(txtLeaveCount.Text); objSalary.SILeaveDeductionAmount = float.Parse(txtDeductionAmt.Text); objSalary.SIMonth = ddlMonth.SelectedItem.Text; objSalary.SIYear = ddlYear.SelectedItem.Text; objSalary.SIAddedByRemarks = ddlSalaryStatus.SelectedItem.Text; objSalary.SIOtherRemarks = FacultyType + " " + "Salary"; objSalary.SIAddedById = Convert.ToInt64(Session["UserId"]); objSalary.SIDate = DateTime.Now; if (txtDeductionAmt.Text != "") { objSalary.SIBasicSalary = float.Parse(txtGrossSalary.Text) - float.Parse(txtDeductionAmt.Text); } else { objSalary.SIBasicSalary = float.Parse(txtGrossSalary.Text); } objSalary.Update(); if (FacultyType == "Teacher") { Response.Redirect("ViewSalaryDetails.aspx?msg=Teacher Salary Details Updated Successfully !"); } else { Response.Redirect("ViewSalaryDetails.aspx?msg=Staff Salary Details Updated Successfully !"); } // Response.Redirect("ViewSalaryDetails.aspx?msg=Salary Details Updated Successfully !"); } else { DataTable dt = TMSSalaryDetails.GetSalaryDetails(null, Convert.ToInt64(Session["AccountID"]), Session["FacultyType"].ToString(), null, ddlMonth.SelectedItem.Text, ddlYear.SelectedItem.Text).Tables[0]; if (dt.Rows.Count > 0) { dvMsg.Visible = true; lblMessage.Text = "Salary Details Already Added for this Month and Year !"; dvMsg.Attributes.Add("class", "error_msg"); return; } else { TMSSalaryDetails objSalary = new TMSSalaryDetails(); objSalary.SIFacultyLoginId = Convert.ToInt64(Session["AccountID"]); if (rbtmonth.Checked == true) { objSalary.SISalaryType = "Monthly"; } else if (rbtYear.Checked == true) { objSalary.SISalaryType = "Yearly"; } objSalary.SIFacultyType = Session["FacultyType"].ToString(); objSalary.SIGrossSalary = float.Parse(txtGrossSalary.Text); objSalary.SILeaveCount = Convert.ToInt32(txtLeaveCount.Text); objSalary.SILeaveDeductionAmount = float.Parse(txtDeductionAmt.Text); if (txtDeductionAmt.Text != "") { objSalary.SIBasicSalary = float.Parse(txtGrossSalary.Text) - float.Parse(txtDeductionAmt.Text); } else { objSalary.SIBasicSalary = float.Parse(txtGrossSalary.Text); } objSalary.SIMonth = ddlMonth.SelectedItem.Text; objSalary.SIYear = ddlYear.SelectedItem.Text; objSalary.SIAddedByRemarks = ddlSalaryStatus.SelectedItem.Text; objSalary.SIOtherRemarks = FacultyType + " " + "Salary"; objSalary.SIAddedById = Convert.ToInt64(Session["UserId"]); objSalary.SIDate = DateTime.Now; objSalary.SIStatus = 1; objSalary.Insert(); if (FacultyType == "Teacher") { Response.Redirect("ViewSalaryDetails.aspx?msg=Teacher Salary Details Added Successfully !"); } else { Response.Redirect("ViewSalaryDetails.aspx?msg=Staff Salary Details Added Successfully !"); } } } } catch (Exception ex) { } { } }
public static TMSFacultyType[] Search(TMSFacultyType searchObject) { return Search ( searchObject.FTFacultyId, searchObject.FTFacultyName, searchObject.FTDate, searchObject.FTStatus); }
public static TMSFacultyType[] MapFrom(DataSet ds) { List<TMSFacultyType> objects; // Initialise Collection. objects = new List<TMSFacultyType>(); // 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_FacultyType] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_FacultyType] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSFacultyType instance = new TMSFacultyType(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSFacultyType Get(System.Int64 ftFacultyId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSFacultyType instance; instance = new TMSFacultyType(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSFacultyType_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, ftFacultyId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSFacultyType ID:" + ftFacultyId.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }