public static TMSSalaryDetails Get(System.Int64 siDetailsId)
    {
        DataSet          ds;
        Database         db;
        string           sqlCommand;
        DbCommand        dbCommand;
        TMSSalaryDetails instance;


        instance = new TMSSalaryDetails();

        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSSalaryDetails_SELECT";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, siDetailsId);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSSalaryDetails ID:" + siDetailsId.ToString()+ " from Database.");
        // Return results.
        {
            return(null);
        }
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    protected void Checksalary()
    {
        try
        {
            btnsave.Text         = "Update";
            HiddenSalaryId.Value = Request.QueryString["SI_DetailsId"];
            Int64 SalaryDetailsId = Convert.ToInt64(Request.QueryString["SI_DetailsId"]);

            TMSSalaryDetails obj = TMSSalaryDetails.Get(Convert.ToInt64(SalaryDetailsId));

            if (obj.SISalaryType != null)
            {
                if (obj.SISalaryType == "Monthly")
                {
                    rbtmonth.Checked = true;
                }
                else
                {
                    rbtYear.Checked = true;
                }
            }
            // txtBasicSalary.Text = obj.SIBasicSalary.ToString();
            txtGrossSalary.Text           = obj.SIGrossSalary.ToString();
            txtLeaveCount.Text            = obj.SILeaveCount.ToString();
            txtDeductionAmt.Text          = obj.SILeaveDeductionAmount.ToString();
            ddlMonth.SelectedValue        = obj.SIMonth.ToString();
            ddlYear.SelectedValue         = obj.SIYear.ToString();
            ddlSalaryStatus.SelectedValue = obj.SIAddedByRemarks.ToString();
        }
        catch (Exception ex) { }
    }
예제 #3
0
    private void BindMonthlyDetails()
    {
        string Month = null;
        string Year  = null;

        if (ddlMonth.SelectedIndex <= 0)
        {
            Month = null;
        }
        else
        {
            Month = Convert.ToString(ddlMonth.SelectedItem.Text);
        }

        if (ddlYear.SelectedIndex <= 0)
        {
            Year = null;
        }
        else
        {
            Year = Convert.ToString(ddlYear.SelectedItem.Text);
        }

        DataTable dtMonthlyReport = TMSSalaryDetails.GetMonthlyExpenditureDetails(Month, Year).Tables[0];

        if (dtMonthlyReport.Rows.Count > 0)
        {
            lblEleAndWaterSupply.Text   = dtMonthlyReport.Rows[0]["ElectricityAndWaterSupplyBill"].ToString();
            lblSalaryAmt.Text           = dtMonthlyReport.Rows[0]["TeacherAndStaffSalary"].ToString();
            lblSchoolMaintance.Text     = dtMonthlyReport.Rows[0]["SchoolMaintance"].ToString();
            lblTransportManagement.Text = dtMonthlyReport.Rows[0]["TransportManagement"].ToString();
            lblVendorManagement.Text    = dtMonthlyReport.Rows[0]["VendorManagement"].ToString();

            if (lblEleAndWaterSupply.Text == "")
            {
                lblEleAndWaterSupply.Text = "0";
            }
            if (lblSalaryAmt.Text == "")
            {
                lblSalaryAmt.Text = "0";
            }
            if (lblSchoolMaintance.Text == "")
            {
                lblSchoolMaintance.Text = "0";
            }
            if (lblTransportManagement.Text == "")
            {
                lblTransportManagement.Text = "0";
            }
            if (lblVendorManagement.Text == "")
            {
                lblVendorManagement.Text = "0";
            }



            lblTotal.Text = Convert.ToString(Convert.ToInt64(lblEleAndWaterSupply.Text) + Convert.ToInt64(lblSalaryAmt.Text) + Convert.ToInt64(lblSchoolMaintance.Text) + Convert.ToInt64(lblTransportManagement.Text) + Convert.ToInt64(lblVendorManagement.Text));
        }
    }
    protected void grdSalary_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        ViewState["Sort"] = null;
        Label lblSalaryDetailsId = grdSalary.Rows[e.RowIndex].FindControl("lblSalaryDetailsId") as Label;

        TMSSalaryDetails.Delete(Convert.ToInt64(lblSalaryDetailsId.Text), null);
        BindSalryDetailsMonthWise();
        dvMsg.Visible   = true;
        lblMessage.Text = "Record Is Deleted Successfully";
        dvMsg.Attributes.Add("class", "warring_msg");
    }
    protected void BindSalryDetailsMonthWise()
    {
        try
        {
            string Month = null;
            string Year  = null;

            if (ddlMonth1.SelectedIndex <= 0)
            {
                Month = null;
            }
            else
            {
                Month = Convert.ToString(ddlMonth1.SelectedItem.Text);
            }

            if (ddlYear1.SelectedIndex <= 0)
            {
                Year = null;
            }
            else
            {
                Year = Convert.ToString(ddlYear1.SelectedItem.Text);
            }

            DataTable dtSalary = null;

            if (ViewState["Sort"] != null)
            {
                dtSalary = TMSSalaryDetails.GetFacultyAndStaffSalaryDetails(Convert.ToInt64(Session["AccountID"]), Month, Year).Tables[0];
            }
            else
            {
                dtSalary = TMSSalaryDetails.GetFacultyAndStaffSalaryDetails(Convert.ToInt64(Session["AccountID"]), null, null).Tables[0];
            }

            if (dtSalary.Rows.Count > 0)
            {
                grdSalary.DataSource = dtSalary;
                grdSalary.DataBind();
                SectionViewSalary.Visible = true;
                SectionAddSalary.Visible  = false;
            }
            else
            {
                grdSalary.DataSource = null;
                grdSalary.DataBind();
                SectionViewSalary.Visible = true;
                SectionAddSalary.Visible  = false;
            }
        }
        catch (Exception ex) { }
    }
    public static TMSSalaryDetails[] Search(System.Int64?siDetailsId, System.Int64?siFacultyLoginId, System.String siFacultyType, System.String siSalaryType, System.Double?siBasicSalary, System.Double?siGrossSalary, System.Int32?siLeaveCount, System.Double?siLeaveDeductionAmount, System.String siMonth, System.String siYear, System.String siCurrency, System.Double?sipfRate, System.Double?sipfAmount, System.Double?siesiRate, System.Double?siesiAmount, System.Int32?siSetHalfDayHours, System.Int32?silcelFlexibleHours, System.Int32?silcelConvertedDays, System.Int32?silcelcOnvertHalfDay, System.Int32?silcelConvertFullDay, System.DateTime?siDate, System.String siAddedByRemarks, System.Int64?siAddedById, System.String siOtherRemarks, System.Int32?siStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSSalaryDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, siDetailsId, siFacultyLoginId, siFacultyType, siSalaryType, siBasicSalary, siGrossSalary, siLeaveCount, siLeaveDeductionAmount, siMonth, siYear, siCurrency, sipfRate, sipfAmount, siesiRate, siesiAmount, siSetHalfDayHours, silcelFlexibleHours, silcelConvertedDays, silcelcOnvertHalfDay, silcelConvertFullDay, siDate, siAddedByRemarks, siAddedById, siOtherRemarks, siStatus);

        ds = db.ExecuteDataSet(dbCommand);
        ds.Tables[0].TableName = TABLE_NAME;
        return(TMSSalaryDetails.MapFrom(ds));
    }
    public static TMSSalaryDetails[] MapFrom(DataSet ds)
    {
        List <TMSSalaryDetails> objects;


        // Initialise Collection.
        objects = new List <TMSSalaryDetails>();

        // 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_SalaryDetails] in DataSet.");
        }

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        {
            throw new ApplicationException("Table [dbo].[TMS_SalaryDetails] is empty.");
        }

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSSalaryDetails instance = new TMSSalaryDetails();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return(objects.ToArray());
    }
 public static void Update(TMSSalaryDetails tMSSalaryDetails)
 {
     tMSSalaryDetails.Update();
 }
 public static TMSSalaryDetails[] Search(TMSSalaryDetails searchObject)
 {
     return(Search(searchObject.SIDetailsId, searchObject.SIFacultyLoginId, searchObject.SIFacultyType, searchObject.SISalaryType, searchObject.SIBasicSalary, searchObject.SIGrossSalary, searchObject.SILeaveCount, searchObject.SILeaveDeductionAmount, searchObject.SIMonth, searchObject.SIYear, searchObject.SICurrency, searchObject.SIPFRate, searchObject.SIPFAmount, searchObject.SIESIRate, searchObject.SIESIAmount, searchObject.SISetHalfDayHours, searchObject.SILCELFlexibleHours, searchObject.SILCELConvertedDays, searchObject.SILCELCOnvertHalfDay, searchObject.SILCELConvertFullDay, searchObject.SIDate, searchObject.SIAddedByRemarks, searchObject.SIAddedById, searchObject.SIOtherRemarks, searchObject.SIStatus));
 }
    public static TMSSalaryDetails[] MapFrom(DataSet ds)
    {
        List<TMSSalaryDetails> objects;

        // Initialise Collection.
        objects = new List<TMSSalaryDetails>();

        // 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_SalaryDetails] in DataSet.");

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        throw new ApplicationException("Table [dbo].[TMS_SalaryDetails] is empty.");

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSSalaryDetails instance = new TMSSalaryDetails();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return objects.ToArray();
    }
예제 #11
0
 public static DataSet GetSearch(TMSSalaryDetails searchObject)
 {
     return GetSearch(searchObject.SIDetailsId, searchObject.SIFacultyLoginId, searchObject.SIFacultyType, searchObject.SISalaryType, searchObject.SIBasicSalary, searchObject.SIGrossSalary, searchObject.SILeaveCount, searchObject.SILeaveDeductionAmount, searchObject.SIMonth, searchObject.SIYear, searchObject.SICurrency, searchObject.SIPFRate, searchObject.SIPFAmount, searchObject.SIESIRate, searchObject.SIESIAmount, searchObject.SISetHalfDayHours, searchObject.SILCELFlexibleHours, searchObject.SILCELConvertedDays, searchObject.SILCELCOnvertHalfDay, searchObject.SILCELConvertFullDay, searchObject.SIDate, searchObject.SIAddedByRemarks, searchObject.SIAddedById, searchObject.SIOtherRemarks, searchObject.SIStatus);
 }
    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 void Update(TMSSalaryDetails tMSSalaryDetails, DbTransaction transaction)
 {
     tMSSalaryDetails.Update(transaction);
 }
 public static void Update(TMSSalaryDetails tMSSalaryDetails)
 {
     tMSSalaryDetails.Update();
 }
 public static void Update(TMSSalaryDetails tMSSalaryDetails, DbTransaction transaction)
 {
     tMSSalaryDetails.Update(transaction);
 }
    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 TMSSalaryDetails Get(System.Int64 siDetailsId)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSSalaryDetails instance;

        instance = new TMSSalaryDetails();

        db = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSSalaryDetails_SELECT";
        dbCommand = db.GetStoredProcCommand(sqlCommand, siDetailsId);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSSalaryDetails ID:" + siDetailsId.ToString()+ " from Database.");
            // Return results.
            return null;
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }