コード例 #1
0
        public static DataTable FetchLeaveConfigById(Entity.LeaveManagement.LeaveConfiguration objLeaveManagement)
        {
            using (DataTable dt = new DataTable())
            {
                using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()))
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection  = con;
                        cmd.CommandText = "usp_HR_LeaveConfig_GetById";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@LeaveConfigId", objLeaveManagement.LeaveConfigId);
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }

                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(dt);
                        }
                        con.Close();
                    }
                }
                return(dt);
            }
        }
コード例 #2
0
        public static int LeaveConfigurations_Save(Entity.LeaveManagement.LeaveConfiguration objLeaveManagement)
        {
            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_LeaveConfig_Save";
                    cmd.Parameters.AddWithValue("@LeaveConfigId", objLeaveManagement.LeaveConfigId);
                    cmd.Parameters.AddWithValue("@LeaveTypeId", objLeaveManagement.LeaveTypeId);
                    cmd.Parameters.AddWithValue("@LeaveFrequency", objLeaveManagement.LeaveFrequency);
                    cmd.Parameters.AddWithValue("@LeaveAccrueDate", objLeaveManagement.LeaveAccrueDate);
                    cmd.Parameters.AddWithValue("@Encashable", objLeaveManagement.Encashable);

                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    retValue = cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            return(retValue);
        }
コード例 #3
0
 public static DataTable LeaveConfigurations_GetAll(Entity.LeaveManagement.LeaveConfiguration lmLeaveConfig)
 {
     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_LeaveConfig_GetAll";
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(dt);
                 }
                 con.Close();
             }
         }
         return(dt);
     }
 }