예제 #1
0
    private void SaveData()
    {
        string strAllowId = "";

        try
        {
            if (hfIsUpdate.Value == "N")
            {
                strAllowId = Common.getMaxId("RemoteAllowanceAdd", "AllowanceId");
            }
            else
            {
                strAllowId = hfID.Value.ToString();
            }

            string strDateFrom = "";
            string strDateTo   = "";

            if (string.IsNullOrEmpty(txtStartDate.Text.Trim()) == false)
            {
                strDateFrom = Common.ReturnDate(txtStartDate.Text.Trim());
            }

            if (string.IsNullOrEmpty(txtEndDate.Text.Trim()) == false)
            {
                strDateTo = Common.ReturnDate(txtEndDate.Text.Trim());
            }

            Payroll_RemoteAllowannce objclsReAllow = new Payroll_RemoteAllowannce();

            objclsReAllow.AllowanceID    = strAllowId;
            objclsReAllow.EmpId          = txtEmpID.Text.Trim();
            objclsReAllow.PostingDivID   = ddlPostingDiv.SelectedValue.ToString();
            objclsReAllow.SalLocId       = ddlSalaryLoc.SelectedValue.ToString();
            objclsReAllow.PostingPlaceId = ddlPlaceofPosting.SelectedValue.ToString();
            objclsReAllow.DateFrom       = strDateFrom;
            objclsReAllow.DateTo         = strDateTo;
            objclsReAllow.Basic          = lblBasic.Text.Trim();
            objclsReAllow.Percentage     = txtPercentage.Text.Trim();
            objclsReAllow.Amount         = txtAmount.Text.Trim();
            objclsReAllow.Remarks        = txtRemarks.Text.Trim();
            objclsReAllow.InsertedBy     = Session["USERID"].ToString();
            objclsReAllow.InsertedDate   = Common.SetDateTime(DateTime.Now.ToString());

            objVarMgr.InsertRemoteAllowance(objclsReAllow, hfIsUpdate.Value, "N");

            if (hfIsUpdate.Value == "N")
            {
                lblMsg.Text = "Record Saved Successfully";
            }
            else if (hfIsUpdate.Value == "Y")
            {
                lblMsg.Text = "Record Updated Successfully";
            }
            else
            {
                lblMsg.Text = "Record Deleted Successfully";
            }

            this.EntryMode(false);
            this.OpenRecord();
            this.ClearControls();
        }
        catch (Exception ex)
        {
            lblMsg.Text = "";
            throw (ex);
        }
    }
예제 #2
0
    public void InsertRemoteAllowance(Payroll_RemoteAllowannce objReAllow, string IsUpdate, string IsDelete)
    {
        SqlCommand cmd = new SqlCommand("proc_Payroll_Insert_RemoteAllowance");

        cmd.CommandType = CommandType.StoredProcedure;

        SqlParameter p_AllowanceID = cmd.Parameters.Add("AllowanceID", SqlDbType.BigInt);

        p_AllowanceID.Direction = ParameterDirection.Input;
        p_AllowanceID.Value     = objReAllow.AllowanceID;

        SqlParameter p_EmpId = cmd.Parameters.Add("EmpId", SqlDbType.VarChar);

        p_EmpId.Direction = ParameterDirection.Input;
        p_EmpId.Value     = objReAllow.EmpId;

        SqlParameter p_PostingDivID = cmd.Parameters.Add("PostingDivID", SqlDbType.BigInt);

        p_PostingDivID.Direction = ParameterDirection.Input;
        p_PostingDivID.Value     = objReAllow.PostingDivID;

        SqlParameter p_SalLocId = cmd.Parameters.Add("SalLocId", SqlDbType.BigInt);

        p_SalLocId.Direction = ParameterDirection.Input;
        p_SalLocId.Value     = objReAllow.SalLocId;

        SqlParameter p_PostingPlaceId = cmd.Parameters.Add("PostingPlaceId", SqlDbType.BigInt);

        p_PostingPlaceId.Direction = ParameterDirection.Input;
        p_PostingPlaceId.Value     = objReAllow.PostingPlaceId;

        SqlParameter p_DateFrom = cmd.Parameters.Add("DateFrom", DBNull.Value);

        p_DateFrom.Direction  = ParameterDirection.Input;
        p_DateFrom.IsNullable = true;
        if (objReAllow.DateFrom != "")
        {
            p_DateFrom.Value = objReAllow.DateFrom;
        }

        SqlParameter p_DateTo = cmd.Parameters.Add("DateTo", DBNull.Value);

        p_DateTo.Direction  = ParameterDirection.Input;
        p_DateTo.IsNullable = true;
        if (objReAllow.DateTo != "")
        {
            p_DateTo.Value = objReAllow.DateTo;
        }

        SqlParameter p_Basic = cmd.Parameters.Add("BasicSalary", SqlDbType.Decimal);

        p_Basic.Direction  = ParameterDirection.Input;
        p_Basic.IsNullable = true;
        if (objReAllow.Basic != "")
        {
            p_Basic.Value = objReAllow.Basic;
        }

        SqlParameter p_Percentage = cmd.Parameters.Add("Percentage", DBNull.Value);

        p_Percentage.Direction  = ParameterDirection.Input;
        p_Percentage.IsNullable = true;
        if (objReAllow.Percentage != "")
        {
            p_Percentage.Value = objReAllow.Percentage;
        }

        SqlParameter p_Amount = cmd.Parameters.Add("Amount", DBNull.Value);

        p_Amount.Direction  = ParameterDirection.Input;
        p_Amount.IsNullable = true;
        if (objReAllow.Amount != "")
        {
            p_Amount.Value = objReAllow.Amount;
        }

        SqlParameter p_Remarks = cmd.Parameters.Add("Remarks", SqlDbType.VarChar);

        p_Remarks.Direction = ParameterDirection.Input;
        p_Remarks.Value     = objReAllow.Remarks;

        SqlParameter p_InsertedBy = cmd.Parameters.Add("InsertedBy", SqlDbType.VarChar);

        p_InsertedBy.Direction = ParameterDirection.Input;
        p_InsertedBy.Value     = objReAllow.InsertedBy;

        SqlParameter p_UpdatedDate = cmd.Parameters.Add("InsertedDate", SqlDbType.DateTime);

        p_UpdatedDate.Direction = ParameterDirection.Input;
        p_UpdatedDate.Value     = objReAllow.InsertedDate;

        SqlParameter p_IsUpdate = cmd.Parameters.Add("IsUpdate", SqlDbType.Char);

        p_IsUpdate.Direction = ParameterDirection.Input;
        p_IsUpdate.Value     = IsUpdate;

        SqlParameter p_IsDelete = cmd.Parameters.Add("IsDelete", SqlDbType.Char);

        p_IsDelete.Direction = ParameterDirection.Input;
        p_IsDelete.Value     = IsDelete;

        try
        {
            objDC.ExecuteQuery(cmd);
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        finally
        {
            cmd = null;
        }
    }