Ejemplo n.º 1
0
        protected void gvClaimDetails_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "U")
                {
                    GridViewRow gridViewRow        = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
                    HiddenField hdnChecked         = (HiddenField)gridViewRow.FindControl("hdnChecked");
                    TextBox     txtApprovedAmount  = (TextBox)gridViewRow.FindControl("txtApprovedAmount");
                    TextBox     txtApprovedRemarks = (TextBox)gridViewRow.FindControl("txtApprovedRemarks");
                    //DropDownList ddlLineItemStatus = (DropDownList)gridViewRow.FindControl("ddlLineItemStatus");
                    hdnChecked.Value        = "Checked";
                    gridViewRow.Font.Italic = true;
                    gridViewRow.Attributes.CssStyle.Add("color", "#038a10");

                    Business.ClaimManagement.ClaimApplication      objClaimApplication     = new Business.ClaimManagement.ClaimApplication();
                    Entity.ClaimManagement.ClaimApplicationDetails claimApplicationDetails = new Entity.ClaimManagement.ClaimApplicationDetails()
                    {
                        ClaimApplicationDetailId = int.Parse(e.CommandArgument.ToString()),
                        ApprovedAmount           = (string.IsNullOrEmpty(txtApprovedAmount.Text.Trim())) ? 0 : Convert.ToDecimal(txtApprovedAmount.Text.Trim()),
                        ApproverRemarks          = txtApprovedRemarks.Text.Trim(),
                        Status = (int)ClaimStatusEnum.Approved
                    };

                    objClaimApplication.ClaimApplicationDetails_Save(claimApplicationDetails);

                    ComputeTotalApprovedAmount();
                }
                else if (e.CommandName == "A")
                {
                    string claimAttachmentName = e.CommandArgument.ToString();
                    DownloadAttachment(claimAttachmentName);
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();
                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
            finally
            {
                ModalPopupExtender1.Show();
            }
        }
        private int ClaimApplicationDetails_Save(int claimApplicationId, DateTime expenseDate, string attachment, int categoryId, decimal cost, string description, int status)
        {
            Entity.ClaimManagement.ClaimApplicationDetails claimApplicationDetails   = new Entity.ClaimManagement.ClaimApplicationDetails();
            Business.ClaimManagement.ClaimApplication      objClaimApplicationMaster = new Business.ClaimManagement.ClaimApplication();

            claimApplicationDetails.ClaimApplicationDetailId = 0;
            claimApplicationDetails.ClaimApplicationId       = claimApplicationId;
            claimApplicationDetails.ExpenseDate = expenseDate;
            claimApplicationDetails.Attachment  = attachment;
            claimApplicationDetails.CategoryId  = categoryId;
            claimApplicationDetails.Cost        = cost;
            claimApplicationDetails.Description = description;
            claimApplicationDetails.Status      = status;
            int response = objClaimApplicationMaster.ClaimApplicationDetails_Save(claimApplicationDetails);

            return(response);
        }
        public static DataTable ClaimApplicationDetails_GetAll(Entity.ClaimManagement.ClaimApplicationDetails ClaimApplicationDetails)
        {
            using (DataTable dt = new DataTable())
            {
                using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()))
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection  = con;
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.CommandText = "usp_HR_ClaimApplicationDetails_GetAll";

                        if (ClaimApplicationDetails.ClaimApplicationId == 0)
                        {
                            cmd.Parameters.AddWithValue("@ClaimApplicationId", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.AddWithValue("@ClaimApplicationId", ClaimApplicationDetails.ClaimApplicationId);
                        }
                        if (ClaimApplicationDetails.ClaimApplicationDetailId == 0)
                        {
                            cmd.Parameters.AddWithValue("@ClaimApplicationDetailId", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.AddWithValue("@ClaimApplicationDetailId", ClaimApplicationDetails.ClaimApplicationDetailId);
                        }

                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(dt);
                        }
                        con.Close();
                    }
                }
                return(dt);
            }
        }
 public DataTable ClaimApplicationDetails_GetAll(Entity.ClaimManagement.ClaimApplicationDetails ClaimApplicationDetails)
 {
     return(DataAccess.ClaimManagement.ClaimApplication.ClaimApplicationDetails_GetAll(ClaimApplicationDetails));
 }
 public int ClaimApplicationDetails_Save(Entity.ClaimManagement.ClaimApplicationDetails ClaimApplicationDetails)
 {
     return(DataAccess.ClaimManagement.ClaimApplication.ClaimApplicationDetails_Save(ClaimApplicationDetails));
 }
        public static int ClaimApplicationDetails_Save(Entity.ClaimManagement.ClaimApplicationDetails ClaimApplicationDetails)
        {
            int retValue = 0;

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = con;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "usp_HR_ClaimDetails_Save";

                    cmd.Parameters.AddWithValue("@ClaimDetailsId", ClaimApplicationDetails.ClaimApplicationDetailId);
                    cmd.Parameters.AddWithValue("@ClaimId", ClaimApplicationDetails.ClaimApplicationId);
                    cmd.Parameters.AddWithValue("@Cost", ClaimApplicationDetails.Cost);
                    if (ClaimApplicationDetails.ExpenseDate == DateTime.MinValue)
                    {
                        cmd.Parameters.AddWithValue("@ExpenseDate", DBNull.Value);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@ExpenseDate", ClaimApplicationDetails.ExpenseDate);
                    }
                    if (string.IsNullOrEmpty(ClaimApplicationDetails.Attachment))
                    {
                        cmd.Parameters.AddWithValue("@Attachment", DBNull.Value);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@Attachment", ClaimApplicationDetails.Attachment);
                    }
                    if (ClaimApplicationDetails.CategoryId == 0)
                    {
                        cmd.Parameters.AddWithValue("@CategoryId", DBNull.Value);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@CategoryId", ClaimApplicationDetails.CategoryId);
                    }
                    if (string.IsNullOrEmpty(ClaimApplicationDetails.Description))
                    {
                        cmd.Parameters.AddWithValue("@Description", DBNull.Value);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@Description", ClaimApplicationDetails.Description);
                    }
                    if (ClaimApplicationDetails.Status == 0)
                    {
                        cmd.Parameters.AddWithValue("@Status", DBNull.Value);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@Status", ClaimApplicationDetails.Status);
                    }
                    if (string.IsNullOrEmpty(ClaimApplicationDetails.ApproverRemarks))
                    {
                        cmd.Parameters.AddWithValue("@ApproverRemarks", DBNull.Value);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@ApproverRemarks", ClaimApplicationDetails.ApproverRemarks);
                    }

                    cmd.Parameters.AddWithValue("@ApprovedAmount", ClaimApplicationDetails.ApprovedAmount);

                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    retValue = cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            return(retValue);
        }