コード例 #1
0
 public static DataTable EmployeeHolidayProfileMapping_GetAll(Entity.HR.EmployeeHolidayProfileMapping employeeHolidayProfileMapping)
 {
     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_EmployeeHolidayProfileMapping_GetAll";
                 if (employeeHolidayProfileMapping.HolidayProfileId == 0)
                 {
                     cmd.Parameters.AddWithValue("@HolidayProfileId", DBNull.Value);
                 }
                 else
                 {
                     cmd.Parameters.AddWithValue("@HolidayProfileId", employeeHolidayProfileMapping.HolidayProfileId);
                 }
                 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 EmployeeHolidayProfileMapping_Save(Entity.HR.EmployeeHolidayProfileMapping employeeHolidayProfileMapping)
        {
            int rowsAffacted = 0;

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = con;
                    cmd.CommandText = "usp_HR_EmployeeHolidayProfileMapping_Save";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@EmployeeHolidayProfileMappingId", employeeHolidayProfileMapping.EmployeeHolidayProfileMappingId);
                    cmd.Parameters.AddWithValue("@HolidayProfileId", employeeHolidayProfileMapping.HolidayProfileId);
                    cmd.Parameters.AddWithValue("@EmployeeId", employeeHolidayProfileMapping.EmployeeId);
                    cmd.Parameters.AddWithValue("@Active", employeeHolidayProfileMapping.Active);
                    cmd.Parameters.AddWithValue("@CreatedBy", employeeHolidayProfileMapping.CreatedBy);
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    rowsAffacted = cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            return(rowsAffacted);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Business.HR.HolidayProfile objHolidayProfile = new Business.HR.HolidayProfile();
                Entity.HR.EmployeeHolidayProfileMapping employeeHolidayProfileMapping = new Entity.HR.EmployeeHolidayProfileMapping();
                employeeHolidayProfileMapping.EmployeeHolidayProfileMappingId = EmployeeHolidayProfileMappingId;
                employeeHolidayProfileMapping.EmployeeId       = int.Parse(ddlEmployee.SelectedValue);
                employeeHolidayProfileMapping.HolidayProfileId = int.Parse(ddlHolidayProfile.SelectedValue);
                employeeHolidayProfileMapping.Active           = true;
                employeeHolidayProfileMapping.CreatedBy        = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                int RowsAffected = objHolidayProfile.EmployeeHolidayProfileMapping_Save(employeeHolidayProfileMapping);

                if (RowsAffected > 0)
                {
                    ClearControls();
                    LoadEmployeeHolidayProfileMappingList();
                    Message.IsSuccess = true;
                    Message.Text      = "Saved Successfully";
                }
                else
                {
                    Message.IsSuccess = false;
                    Message.Text      = "Failed!";
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
            Message.Show = true;
        }
コード例 #4
0
 public DataTable EmployeeHolidayProfileMapping_GetAll(Entity.HR.EmployeeHolidayProfileMapping employeeHolidayProfileMapping)
 {
     return(DataAccess.HR.HolidayProfile.EmployeeHolidayProfileMapping_GetAll(employeeHolidayProfileMapping));
 }
コード例 #5
0
 public int EmployeeHolidayProfileMapping_Save(Entity.HR.EmployeeHolidayProfileMapping employeeHolidayProfileMapping)
 {
     return(DataAccess.HR.HolidayProfile.EmployeeHolidayProfileMapping_Save(employeeHolidayProfileMapping));
 }