public static DataTable VoucherPayment_GetAll(Entity.ClaimManagement.VoucherPayment VoucherPayment)
 {
     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_VoucherPayment_GetAll";
                 if (string.IsNullOrEmpty(VoucherPayment.VoucherNo))
                 {
                     cmd.Parameters.AddWithValue("@VoucherNo", DBNull.Value);
                 }
                 else
                 {
                     cmd.Parameters.AddWithValue("@VoucherNo", VoucherPayment.VoucherNo);
                 }
                 if (con.State == ConnectionState.Closed)
                 {
                     con.Open();
                 }
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(dt);
                 }
                 con.Close();
             }
         }
         return(dt);
     }
 }
        public static int VoucherPayment_Save(Entity.ClaimManagement.VoucherPayment VoucherPayment)
        {
            int rowsAffacted = 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_VoucherPayment_Save";
                    cmd.Parameters.AddWithValue("@VoucherPaymentId", VoucherPayment.VoucherPaymentId).Direction = ParameterDirection.InputOutput;
                    cmd.Parameters.AddWithValue("@VoucherId", VoucherPayment.VoucherId);
                    cmd.Parameters.AddWithValue("@TotalAmount", VoucherPayment.TotalAmount);
                    cmd.Parameters.AddWithValue("@CreatedBy", VoucherPayment.CreatedBy);

                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    cmd.ExecuteNonQuery();
                    rowsAffacted = Convert.ToInt32(cmd.Parameters["@VoucherPaymentId"].Value);
                    con.Close();
                }
            }
            return(rowsAffacted);
        }
 public DataTable VoucherPayment_GetAll(Entity.ClaimManagement.VoucherPayment voucherPayment)
 {
     return(DataAccess.ClaimManagement.VoucherPayment.VoucherPayment_GetAll(voucherPayment));
 }
 public int VoucherPayment_Save(Entity.ClaimManagement.VoucherPayment voucherPayment)
 {
     return(DataAccess.ClaimManagement.VoucherPayment.VoucherPayment_Save(voucherPayment));
 }