예제 #1
0
 protected void btnSubmit_Click(object sender, System.EventArgs e)
 {
     try
     {
         //InsertEmployee();
         //InsertSubcategoryAssignment();
         clsSubCategoryAssignment   objClsSubCategoryAssignment   = new clsSubCategoryAssignment();
         clsBLSubCategoryAssignment objClsBLSubCategoryAssignment = new clsBLSubCategoryAssignment();
         objClsSubCategoryAssignment.EmployeeID = Convert.ToInt32(ddlEmployeeName.SelectedItem.Value);
         int noOfRowsReturned = objClsBLSubCategoryAssignment.DoesEmployeeExist(objClsSubCategoryAssignment);
         if (noOfRowsReturned == 0)
         {
             lblEmployee.Visible = false;
             InsertEmployeeRoles();
         }
         else
         {
             lblEmployee.Visible       = true;
             lblEmployee.Text          = "EmployeeID " + objClsSubCategoryAssignment.EmployeeID + " already exists";
             lblSuccessMessage.Visible = false;
         }
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "SubCategoryAssignment.aspx", "btnSubmit_Click", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
예제 #2
0
        public void InsertEmployeeRoles()
        {
            try
            {
                fillNewTable();
                InsertEmployee();
                InsertSubcategoryAssignment();
                lblSuccessMessage.Visible = true;
                lblSuccessMessage.Text    = "Sub-Categories have been successfully assigned to " + ddlEmployeeName.SelectedItem.Text + ".";

                for (int recordCount = 0; recordCount <= dtNewTable.Rows.Count - 1; recordCount++)
                {
                    clsSubCategoryAssignment objClsSubCategoryAssignment = new clsSubCategoryAssignment();
                    objClsSubCategoryAssignment.EmployeeID = Convert.ToInt32(dtNewTable.Rows[recordCount][0]);
                    objClsSubCategoryAssignment.CategoryID = Convert.ToInt32(dtNewTable.Rows[recordCount][1]);
                    objClsSubCategoryAssignment.IsSysAdmin = Convert.ToInt32(dtNewTable.Rows[recordCount][2]);
                    clsBLSubCategoryAssignment objClsBLSubCategoryAssignment = new clsBLSubCategoryAssignment();
                    objClsBLSubCategoryAssignment.InsertEmployeeRoles(objClsSubCategoryAssignment);
                }
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "SubCategoryAssignment.aspx", "InsertEmployeeRoles", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
예제 #3
0
 public void bindDataGrid()
 {
     try
     {
         clsBLSubCategoryAssignment objClsBLSubCategoryAssignment = new clsBLSubCategoryAssignment();
         DataSet dsGetData = objClsBLSubCategoryAssignment.getData();
         dgCategories.DataSource = dsGetData.Tables[0];
         dgCategories.DataBind();
         if (dgCategories.PageCount > 1)
         {
             dgCategories.PagerStyle.Visible = true;
         }
         else
         {
             dgCategories.PagerStyle.Visible = false;
         }
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "SubCategoryAssignment.aspx", "bindDataGrid", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
예제 #4
0
 public void bindEmployeeNames()
 {
     try
     {
         clsBLSubCategoryAssignment objClsBLSubCategoryAssignment = new clsBLSubCategoryAssignment();
         DataSet dsBindEmployeeNames = objClsBLSubCategoryAssignment.getEmployeeNames();
         if (dsBindEmployeeNames.Tables[0].Rows.Count >= 1)
         {
             ddlEmployeeName.DataSource     = dsBindEmployeeNames.Tables[0];
             ddlEmployeeName.DataTextField  = dsBindEmployeeNames.Tables[0].Columns["Emp_Name"].ToString();
             ddlEmployeeName.DataValueField = dsBindEmployeeNames.Tables[0].Columns["Emp_User_Name"].ToString();
             ddlEmployeeName.DataBind();
         }
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "SubCategoryAssignment.aspx", "bindEmployeeNames", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
예제 #5
0
        public void InsertSubcategoryAssignment()
        {
            try
            {
                string subCategoryList = "";
                if (lbSelectedAdminSubCategories != null)
                {
                    //Response.Write(lbSelectedAdminSubCategories.Items.ToString());

                    /*for (int i=0; i <= lbSelectedAdminSubCategories.Items.Count-1; i++)
                     * {
                     *  subCategoryList = subCategoryList + lbSelectedAdminSubCategories.Items + ",";
                     * }*/
                    foreach (ListItem item in lbSelectedAdminSubCategories.Items)
                    {
                        subCategoryList = subCategoryList + item.Value + ",";
                    }
                }
                if (lbSelectedHRSubCategories != null)
                {
                    foreach (ListItem item in lbSelectedHRSubCategories.Items)
                    {
                        subCategoryList = subCategoryList + item.Value + ",";
                    }
                }
                if (lbSelectedITSubCategories != null)
                {
                    foreach (ListItem item in lbSelectedITSubCategories.Items)
                    {
                        subCategoryList = subCategoryList + item.Value + ",";
                    }
                }
                subCategoryList = subCategoryList.Trim(',');
                clsSubCategoryAssignment objClsSubCategoryAssignment = new clsSubCategoryAssignment();
                objClsSubCategoryAssignment.SubCategoryID = subCategoryList;
                objClsSubCategoryAssignment.EmployeeID    = Convert.ToInt32(ddlEmployeeName.SelectedItem.Value);
                clsBLSubCategoryAssignment objClsBLSubCategoryAssignment = new clsBLSubCategoryAssignment();
                objClsBLSubCategoryAssignment.InsertSubCategoryAssignment(objClsSubCategoryAssignment);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "SubCategoryAssignment.aspx", "InsertSubcategoryAssignment", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
예제 #6
0
 public void dgCategories_IsCateogrySelected(object sender, System.EventArgs e)
 {
     try
     {
         CheckBox     chkIsCategorySelected = (CheckBox)sender;
         DataGridItem item = (DataGridItem)chkIsCategorySelected.Parent.Parent;
         clsBLSubCategoryAssignment objClsBLSubCategoryAssignment = new clsBLSubCategoryAssignment();
         clsSubCategoryAssignment   objClsSubCategoryAssignment   = new clsSubCategoryAssignment();
         DataSet dsAdminSubCategories = objClsBLSubCategoryAssignment.getSubCategories();
         if (((CheckBox)item.FindControl("chkBoxCategory")).Text == "Admin")
         {
             if (chkIsCategorySelected.Checked == false)
             {
                 RemoveAllAdmin();
             }
         }
         else if (((CheckBox)item.FindControl("chkBoxCategory")).Text == "IT")
         {
             if (chkIsCategorySelected.Checked == false)
             {
                 RemoveAllIT();
             }
         }
         else if (((CheckBox)item.FindControl("chkBoxCategory")).Text == "HR")
         {
             if (chkIsCategorySelected.Checked == false)
             {
                 RemoveAllHR();
             }
         }
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "SubCategoryAssignment.aspx", "dgCategories_IsCateogrySelected", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
예제 #7
0
 //To Bind the ListBoxes with the SubCategories fetched form the Databse
 private void bindSubCategories()
 {
     try
     {
         clsBLSubCategoryAssignment objClsBLSubCategoryAssignment = new clsBLSubCategoryAssignment();
         clsSubCategoryAssignment   objClsSubCategoryAssignment   = new clsSubCategoryAssignment();
         DataSet dsAdminSubCategories = objClsBLSubCategoryAssignment.getSubCategories();
         if (dsAdminSubCategories.Tables[0].Rows.Count >= 1)
         {
             lbAvailableAdminSubCategories.DataSource     = dsAdminSubCategories.Tables[0];
             lbAvailableAdminSubCategories.DataValueField = dsAdminSubCategories.Tables[0].Columns["SubCategoryID"].ToString();
             lbAvailableAdminSubCategories.DataTextField  = dsAdminSubCategories.Tables[0].Columns["SubCategory"].ToString();
             lbAvailableAdminSubCategories.DataBind();
         }
         if (dsAdminSubCategories.Tables[1].Rows.Count >= 1)
         {
             lbAvailableITSubCategories.DataSource     = dsAdminSubCategories.Tables[1];
             lbAvailableITSubCategories.DataValueField = dsAdminSubCategories.Tables[1].Columns["SubCategoryID"].ToString();
             lbAvailableITSubCategories.DataTextField  = dsAdminSubCategories.Tables[1].Columns["SubCategory"].ToString();
             lbAvailableITSubCategories.DataBind();
         }
         if (dsAdminSubCategories.Tables[2].Rows.Count >= 1)
         {
             lbAvailableHRSubCategories.DataSource     = dsAdminSubCategories.Tables[2];
             lbAvailableHRSubCategories.DataValueField = dsAdminSubCategories.Tables[2].Columns["SubCategoryID"].ToString();
             lbAvailableHRSubCategories.DataTextField  = dsAdminSubCategories.Tables[2].Columns["SubCategory"].ToString();
             lbAvailableHRSubCategories.DataBind();
         }
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "SubCategoryAssignment.aspx", "bindSubCategories", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
예제 #8
0
 private void InsertEmployee()
 {
     try
     {
         clsSubCategoryAssignment   objClsSubCategoryAssignment   = new clsSubCategoryAssignment();
         clsBLSubCategoryAssignment objClsBLSubCategoryAssignment = new clsBLSubCategoryAssignment();
         objClsSubCategoryAssignment.EmployeeID = Convert.ToInt32(ddlEmployeeName.SelectedItem.Value);
         string strEmployeeEmailID = objClsBLSubCategoryAssignment.getEmployeeEmailID(objClsSubCategoryAssignment);
         objClsSubCategoryAssignment.EmployeeEmailID = strEmployeeEmailID;
         objClsSubCategoryAssignment.EmployeeName    = ddlEmployeeName.SelectedItem.Text;
         objClsSubCategoryAssignment.IsActive        = 1;
         objClsBLSubCategoryAssignment.InsertEmployee(objClsSubCategoryAssignment);
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "SubCategoryAssignment.aspx", "InsertEmployee", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }