Exemple #1
0
        public DataSet GetCategoryEmployeeNames(clsCategory objClsCategory)
        {
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[1];

                sqlParams[0]           = new SqlParameter("@CategoryID", SqlDbType.Int, 4);
                sqlParams[0].Value     = objClsCategory.CategoryID;
                sqlParams[0].Direction = ParameterDirection.Input;


                DataSet dsRowsReturned = SqlHelper.ExecuteDataset(strConnectionString, CommandType.StoredProcedure, "GetCategoryEmployeeName", sqlParams);
                return(dsRowsReturned);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLCategory.cs", "GetCategoryEmployeeNames", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #2
0
        public int InsertCategory(clsCategory objClsCategory)
        {
            try
            {
                int            noOfRowsReturned = 0;
                SqlParameter[] sqlParams        = new SqlParameter[3];
                sqlParams[0]           = new SqlParameter("@Category", SqlDbType.VarChar, 100);
                sqlParams[0].Value     = objClsCategory.AddCategories;
                sqlParams[0].Direction = ParameterDirection.Input;

                sqlParams[1]           = new SqlParameter("@IsActive", SqlDbType.Bit, 1);
                sqlParams[1].Value     = objClsCategory.AddIdActive;
                sqlParams[1].Direction = ParameterDirection.Input;

                sqlParams[2]           = new SqlParameter("@EmployeeId", SqlDbType.VarChar, 100);
                sqlParams[2].Value     = objClsCategory.EmployeeId;
                sqlParams[2].Direction = ParameterDirection.Input;

                noOfRowsReturned = SqlHelper.ExecuteNonQuery(strConnectionString, CommandType.StoredProcedure, "sp_InsertCategory", sqlParams);
                return(noOfRowsReturned);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLCategory.cs", "InsertCategory", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #3
0
        public int upDateCategory(clsCategory objClsCategory)
        {
            try
            {
                //clsCategory objClsCategory = new clsCategory();
                int            noOfRowsReturned = 0;
                SqlParameter[] sqlParams        = new SqlParameter[3];
                sqlParams[0]           = new SqlParameter("@CategoryID", SqlDbType.Int, 4);
                sqlParams[0].Value     = objClsCategory.CategoryID;
                sqlParams[0].Direction = ParameterDirection.Input;

                sqlParams[1]           = new SqlParameter("@Category", SqlDbType.VarChar, 100);
                sqlParams[1].Value     = objClsCategory.NewCategory;
                sqlParams[1].Direction = ParameterDirection.Input;

                sqlParams[2]           = new SqlParameter("@IsActive", SqlDbType.Bit, 1);
                sqlParams[2].Value     = objClsCategory.isActive;
                sqlParams[2].Direction = ParameterDirection.Input;
                noOfRowsReturned       = Convert.ToInt32(SqlHelper.ExecuteScalar(strConnectionString, CommandType.StoredProcedure, "sp_UpdateCategory", sqlParams));
                return(noOfRowsReturned);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLCategory.cs", "upDateCategory", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
 public void dgCategories_Delete(object sender, DataGridCommandEventArgs e)
 {
     try
     {
         pnlAddCategory.Visible = false;
         int         categoryID     = Convert.ToInt16(dgCategories.DataKeys[e.Item.ItemIndex]);
         clsCategory objClsCategory = new clsCategory();
         objClsCategory.CategoryID = categoryID;
         clsBLCategory objClsBLCategory = new clsBLCategory();
         int           NoOfRowsReturned = objClsBLCategory.DeleteCategory(objClsCategory);
         if (NoOfRowsReturned <= 0)
         {
             //lblError.Visible = true;
             //lblError.Text = "Cannot delete this department as some issues under this department are not yet resolved or closed.";
             Page.RegisterStartupScript("key", "<script>alert('Cannot delete this department as some issues under this department are not yet resolved or closed.');</script>");
         }
         else
         {
             lblError.Visible = false;
             lblError.Text    = "";
         }
         dgCategories.EditItemIndex = -1;
         getCategories();
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "categoryMaster.aspx", "dgCategories_Delete", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
Exemple #5
0
        public JsonResult ListCategory()
        {
            Cat = new clsCategory();
            var list = new SelectList(Cat.ListCatagory(), "cid", "Category");

            return(Json(new { data = list }, JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
        protected void cmdEdit_Click(object sender, EventArgs e)
        {
            clsCategory DB = new clsCategory();

            try
            {
                if (txtCategoryid.Text == null)
                {
                    lblResults.Text = "Please enter the category id";
                    return;
                }
                if (txtname.Text == null)
                {
                    lblResults.Text = "Please enter the category name";
                    return;
                }

                int reccount = 0;
                reccount = DB.FindRecKount(txtCategoryid.Text);

                if (reccount > 0)
                {
                    lblResults.Text = "Record already exists!!!";
                    return;
                }

                DB.Delete_rec(txtCategoryid.Text);

                //public string Add_rec(String txtCustomerid, String txtCustomerName, String txtAddress,String txtTelephoneNo) Define the ADO.NET objects.
                //string connectionString =
                //connectionString = WebConfigurationManager.ConnectionStrings["FleetConnectionString"].ConnectionString;

                //string selectSQL = "SELECT * FROM tb_Customer ORDER BY convert(int,customerno)";
                //SqlConnection con = new SqlConnection(connectionString);
                //SqlCommand cmd = new SqlCommand(selectSQL, con);
                //SqlDataAdapter adapter = new SqlDataAdapter(cmd);

                // Fill the DataSet.
                DataSet ds = new DataSet();
                ds = DB.FindTable();
                //adapter.Fill(ds, "tb_Customer");
                // Perform the binding.
                GridView1.DataSource = ds;
                GridView1.DataBind();

                lblResults.Text = "Operation successful";

                txtCategoryid.Text = "";
                txtname.Text       = "";


                return;
            }
            catch (FormatException err)
            {
                EventLog log = new EventLog();
                log.Source = "Milorry Transport Management System";
                log.WriteEntry(err.Message, EventLogEntryType.Error);
            }
        }
 public ActionResult AddProduct()
 {
     Cat = new clsCategory();
     ViewBag.Category = Cat.ListCatagory().Select(i => new SelectListItem()
     {
         Text = i.CategoryName, Value = i.cid.ToString()
     }).ToList();
     return(View());
 }
 public ActionResult UpdateProduct(int id)
 {
     Prod             = new clsProduct();
     Cat              = new clsCategory();
     ViewBag.Category = Cat.ListCatagory().Select(i => new SelectListItem()
     {
         Text = i.CategoryName, Value = i.cid.ToString()
     }).ToList();
     return(View(Prod.ProductList().Find(x => x.Pid == id)));
 }
Exemple #9
0
        private void LoadCategory()
        {
            clsCategory Dal   = new clsCategory();
            DataSet     Manuf = Dal.LoadCategory();

            ddlCategory.DataTextField  = "CategoryName";
            ddlCategory.DataValueField = "CategoryId";
            ddlCategory.DataSource     = Manuf.Tables[0];
            ddlCategory.DataBind();
            ddlCategory.Items.Insert(0, new ListItem("--Select Category--", string.Empty));
        }
Exemple #10
0
        protected void AddCourse_OnClick(object sender, EventArgs e)
        {
            Security objSecurity = new Security();

            #region "variables"
            string vCategoryId   = dropCategory.SelectedItem.Value;
            string vCourseTitle  = objSecurity.KillChars(txtTitle.Text);
            string vCourseDesc   = objSecurity.KillChars(txtDesc.Text);
            int    v3PartyExam   = 0;
            int    vPassScoreReq = 0;
            int    vAttendReq    = 0;
            if (chkThirdPartExam.Checked)
            {
                v3PartyExam = 1;
            }

            if (chkPassScoreReq.Checked)
            {
                vPassScoreReq = 1;
            }
            if (chkAttendReq.Checked)
            {
                vAttendReq = 1;
            }
            string vPassScore = objSecurity.KillChars(txtPassScore.Text);

            #endregion
            clsCategory objCourse = new clsCategory();
            objCourse.ACRDCatID      = Convert.ToInt32(vCategoryId);
            objCourse.CatTitle       = vCourseTitle;
            objCourse.CatDescription = vCourseDesc;
            objCourse.ThirdPartyExam = v3PartyExam;
            objCourse.PassScoreReq   = vPassScoreReq;
            objCourse.PassScore      = vPassScore;
            objCourse.AttendanceReq  = vAttendReq;
            objCourse.CreateDate     = DateTime.Now;
            objCourse.CreatedBy      = HttpContext.Current.Session["UserAuthId"].ToString();
            objCourse.UpdatedDate    = Convert.ToDateTime("1/1/1900");
            objCourse.UpdatedBy      = "";
            objCourse.Notes          = "";
            objCourse.IsActive       = 1;
            if (CategoryDAL.InsertCategory(objCourse))
            {
                Response.Redirect("MDEMgmtCourses.aspx?mdecourse=active");
                //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Course Added successfully!', '', 'success', 'MDEMgmtCourses.aspx?mdecourse=active');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Error: Cannot add a Course!', '', 'danger', 'MDEMgmtCourses.aspx?mdecourse=active');", true);
            }
        }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         StringBuilder strXML = new StringBuilder();
         bool          check  = false;
         int           cnt    = 0;
         strXML.Append("<ent_category>");
         for (int i = 0; i < gvCategory.Rows.Count; i++)
         {
             CheckBox chk = (CheckBox)gvCategory.Rows[i].FindControl("DeleteRows");
             if (chk.Checked == true)
             {
                 cnt++;
                 check = true;
                 string categoryRowID = gvCategory.Rows[i].Cells[2].Text;
                 strXML.Append("<Category>");
                 strXML.Append("<RowID>" + categoryRowID + "</RowID>");
                 strXML.Append("</Category>");
             }
         }
         strXML.Append("</ent_category>");
         if (check == false)
         {
             lblMessages.Text    = "Please select record to delete.";
             lblMessages.Visible = true;
         }
         if (cnt > 0)
         {
             clsCategory objData = new clsCategory();
             objData.CreatedBy = Session["uid"].ToString();
             clsCategoryMasterViewHandler.UpdateUserDetails(objData, "Delete", strXML.ToString(), ref strErrMsg, ref strSuccMsg, clsCommonHandler.PageName());
             if (strErrMsg.Length >= 1)
             {
                 lblMessages.Text    = strErrMsg;
                 lblMessages.Visible = true;
             }
             else
             {
                 lblMessages.Text    = strSuccMsg;
                 lblMessages.Visible = true;
                 bindDataGrid();
             }
         }
     }
     catch (Exception ex)
     {
         UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
     }
 }
Exemple #12
0
 private void fillGrid()
 {
     try
     {
         clsCategory objCategory = new clsCategory();
         DataSet     ds          = new DataSet();
         objCategory.Action = "SELECT";
         ds = objCategory.fnCategory();
         gvCategory.DataSource = ds;
         gvCategory.DataBind();
         ViewState["dt"] = ds.Tables[0];
     }
     catch (Exception ex)
     { }
 }
Exemple #13
0
 protected void btnSubmit_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (txtAddCategory.Text == "")
         {
             getCategories();
             //				pnlAddCategory.Visible = true;
             lblMessage.Visible = true;
         }
         else
         {
             clsCategory   objClsCategory   = new clsCategory();
             clsBLCategory objClsBLCategory = new clsBLCategory();
             objClsCategory.AddCategories = Server.HtmlEncode(txtAddCategory.Text.Trim());
             int noOfRowsReturned = 0;
             noOfRowsReturned = objClsBLCategory.DoesExist(objClsCategory);
             if (noOfRowsReturned >= 1)
             {
                 lblMessage.Text    = "This DepartMent is already existing in the Table.";
                 lblMessage.Visible = true;
                 //					pnlAddCategory.Visible = true;
                 getCategories();
             }
             else
             {
                 objClsCategory.AddCategories = Server.HtmlEncode(txtAddCategory.Text.Trim());
                 objClsCategory.AddIdActive   = Convert.ToInt32(ddlAddStatus.SelectedValue);
                 objClsCategory.EmployeeId    = ddlEmployeeName.SelectedValue.ToString();
                 objClsBLCategory.InsertCategory(objClsCategory);
                 pnlAddCategory.Visible     = false;
                 txtAddCategory.Text        = "";
                 ddlAddStatus.SelectedIndex = 0;
                 getCategories();
             }
         }
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "categoryMaster.aspx", "btnSubmit_Click", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
Exemple #14
0
 public int updateCategories(clsCategory objClsCategories)
 {
     try
     {
         return(objclsBLCategory.updateCategories(objClsCategories));
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "categoryMaster.aspx", "updateCategories", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
Exemple #15
0
        private void dgCategories_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                pnlAddCategory.Visible = false;
                EmployeePanel.Visible  = true;
                DataSet       dsEmployee       = new DataSet();
                clsBLCategory objClsBLCategory = new clsBLCategory();
                clsCategory   objClsCategory   = new clsCategory();
                if (e.CommandName == "View")
                {
                    strCatagory = null;
                    objClsCategory.CategoryID = Convert.ToInt32(dgCategories.DataKeys[e.Item.ItemIndex]);

                    Label lblCategory = (Label)dgCategories.Items[e.Item.ItemIndex].FindControl("lblCategory");
                    lblEmployeeList.Text = "List of Administrator for Department <b> " + lblCategory.Text + " </b> ";

                    dsEmployee = objClsBLCategory.GetCategoryEmployeeNames(objClsCategory);

                    for (int i = 0; i < dsEmployee.Tables[0].Rows.Count; i++)
                    {
                        strCatagory           = strCatagory + "" + dsEmployee.Tables[0].Rows[i][0].ToString();
                        strCatagory           = strCatagory + "</br>";
                        lblEmployeename1.Text = strCatagory.Replace("<br>", "/r/n");
                    }
                    if (dsEmployee.Tables[0].Rows.Count == 0)
                    {
                        lblEmployeeList.Text  = " Administrator Not available for <b>" + lblCategory.Text + " </b> Department";
                        lblEmployeename1.Text = "";
                        //lblEmployeename1.Text = dsEmployee.Tables[0].Rows[0][0].ToString();
                    }
                    EmployeePanel.Visible = true;
                }
                getCategories();
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "categoryMaster.aspx", "dgCategories_ItemCommand", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #16
0
        public int upDateCategories(clsCategory objClsCategories)
        {
            int noOfRowsReturned = 0;
            int employeeID       = 0;

            try
            {
                SqlParameter[] sqlParams = new SqlParameter[4];
                sqlParams[0]           = new SqlParameter("@CategoryID", SqlDbType.Int, 4);
                sqlParams[0].Value     = objClsCategories.CategoryID;
                sqlParams[0].Direction = ParameterDirection.Input;

                sqlParams[1]           = new SqlParameter("@Category", SqlDbType.VarChar, 100);
                sqlParams[1].Value     = objClsCategories.Category;
                sqlParams[1].Direction = ParameterDirection.Input;

                sqlParams[2]           = new SqlParameter("@IsActive", SqlDbType.Bit, 1);
                sqlParams[2].Value     = objClsCategories.isActive;
                sqlParams[2].Direction = ParameterDirection.Input;

                if (objClsCategories.EmployeeId != "")
                {
                    employeeID = Convert.ToInt32(objClsCategories.EmployeeId);
                }
                sqlParams[3]           = new SqlParameter("@EmployeeID", SqlDbType.Int, 4);
                sqlParams[3].Value     = employeeID;
                sqlParams[3].Direction = ParameterDirection.Input;

                noOfRowsReturned = Convert.ToInt32(SqlHelper.ExecuteScalar(strConnectionString, CommandType.StoredProcedure, "sp_UpdateCategories", sqlParams));
            }
            catch (SqlException sqlexec)
            {
                throw sqlexec;
            }
            catch (NullReferenceException nullexec)
            {
                throw nullexec;
            }
            catch (Exception exec)
            {
                throw exec;
            }
            return(noOfRowsReturned);
        }
Exemple #17
0
        public int InsertCategory(clsCategory objClsCategory)
        {
            try
            {
                clsDLCategory objClsDLCategory = new clsDLCategory();
                return(objClsDLCategory.InsertCategory(objClsCategory));
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsBLCategory.cs", "InsertCategory", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #18
0
        public int updateCategories(clsCategory objClsCategories)
        {
            try
            {
                clsDLCategory objclsDLCategories = new clsDLCategory();
                return(objclsDLCategories.upDateCategories(objClsCategories));
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsBLCategory.cs", "updateCategories", ex.StackTrace);
                throw new V2Exceptions();
            }
        }
Exemple #19
0
        public int DoesExist(clsCategory objClsCategory)
        {
            try
            {
                clsDLCategory objClsDLCategory = new clsDLCategory();
                return(objClsDLCategory.DoesExist(objClsCategory));
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsBLCategory.cs", "DoesExist", ex.StackTrace);
                throw new V2Exceptions();
            }
        }
Exemple #20
0
        public DataSet GetCategoryEmployeeNames(clsCategory objClsCategory)
        {
            try
            {
                clsDLCategory objclsDLCategory = new clsDLCategory();
                return(objclsDLCategory.GetCategoryEmployeeNames(objClsCategory));
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsBLCategory.cs", "GetCategoryEmployeeNames", ex.StackTrace);
                throw new V2Exceptions();
            }
        }
Exemple #21
0
        private void LoadCategory()
        {
            clsCategory Dal          = new clsCategory();
            DataSet     dsCategory   = Dal.LoadCategory();
            string      htmlCategory = string.Empty;

            if (dsCategory != null && dsCategory.Tables.Count > 0 && dsCategory.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in dsCategory.Tables[0].Rows)
                {
                    htmlCategory += "<li><a href='SearchMedicine.aspx?CategoryId=" + int.Parse("0" + dr["CategoryId"]) + "'>" + Convert.ToString(dr["CategoryName"]) + "</a></li>";
                }
                ltrlCategory.Text = htmlCategory;
            }
            else
            {
                htmlCategory      = "<li><a href='#'>No Category Found</a></li>";
                ltrlCategory.Text = htmlCategory;
            }
        }
Exemple #22
0
        public static Boolean InsertUpdateCategory(clsCategory objCategory)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateCategory";

            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    db.Execute(SpName, objCategory, commandType: CommandType.StoredProcedure);
                }
                isAdded = true;
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            return(isAdded);
        }
Exemple #23
0
        public static clsCategory SelectCategoryById(int?ACRDCatID)
        {
            clsCategory objCategory = new clsCategory();
            bool        isnull      = true;
            string      SpName      = "usp_SelectCategory";
            var         objPar      = new DynamicParameters();

            if (String.IsNullOrEmpty(ACRDCatID.ToString()))
            {
                throw new ArgumentException("Function parameters cannot be blank!");
            }
            else
            {
                try
                {
                    objPar.Add("@ACRDCatID", ACRDCatID, dbType: DbType.Int32);

                    using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                    {
                        objCategory = db.Query <clsCategory>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault();
                        isnull      = false;
                    }
                }
                catch (Exception ex)
                {
                    ErrorHandler.ErrorLogging(ex, false);
                    ErrorHandler.ReadError();
                }
            }

            if (isnull)
            {
                return(null);
            }
            else
            {
                return(objCategory);
            }
        }
Exemple #24
0
        public void getSubCategories()
        {
            try
            {
                clsBLSubCategory objclsBLSubCategory = new clsBLSubCategory();
                clsCategory      objClsCategory      = new clsCategory();
                dsSubCategories = objclsBLSubCategory.getSubCategories();
                if (dsSubCategories.Tables[0].Rows.Count > 0)
                {
                    dgSubCategories.DataSource = dsSubCategories.Tables[0];
                    dgSubCategories.DataBind();
                    if (dgSubCategories.PageCount > 1)
                    {
                        dgSubCategories.PagerStyle.Visible = true;
                    }
                    else
                    {
                        dgSubCategories.PagerStyle.Visible = false;
                    }

                    lblRecordMsg.Visible = false;
                }
                else if (dsSubCategories.Tables[0].Rows.Count <= 0)
                {
                    lblRecordMsg.Visible = true;
                }
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "subCategoryMaster.aspx", "getSubCategories", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #25
0
        public DataSet DoesExistWhenEdited(clsCategory objClsCategory)
        {
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0]           = new SqlParameter("@Category", SqlDbType.VarChar, 100);
                sqlParams[0].Value     = objClsCategory.NewCategory;
                sqlParams[0].Direction = ParameterDirection.Input;
                DataSet dsNoOfRowsReturned = SqlHelper.ExecuteDataset(strConnectionString, CommandType.StoredProcedure, "sp_DoesCategoryExist", sqlParams);
                return(dsNoOfRowsReturned);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLCategory.cs", "DoesExistWhenEdited", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #26
0
        public int DoesExist(clsCategory objClsCategory)
        {
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0]           = new SqlParameter("@Category", SqlDbType.VarChar, 100);
                sqlParams[0].Value     = objClsCategory.AddCategories;
                sqlParams[0].Direction = ParameterDirection.Input;
                int NoOfRowsReturned = Convert.ToInt32(SqlHelper.ExecuteScalar(strConnectionString, CommandType.StoredProcedure, "sp_DoesCategoryExist", sqlParams));
                return(NoOfRowsReturned);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLCategory.cs", "DoesExist", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #27
0
        private void Parameters(string Action, int CategoryId)
        {
            try
            {
                if (txtCategoryName.Text != "")
                {
                    clsCategory objCategory = new clsCategory();
                    DataSet     ds          = new DataSet();
                    objCategory.Action       = Action;
                    objCategory.CategoryId   = CategoryId;
                    objCategory.CategoryName = txtCategoryName.Text;
                    objCategory.Description  = txtDescription.Text;

                    ds = objCategory.fnCategory();
                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        divAlert.Visible   = true;
                        divAlert.InnerHtml = ds.Tables[0].Rows[0]["MSG"].ToString();
                    }
                    else
                    {
                        divAlert.Visible   = true;
                        divAlert.InnerHtml = "Something went wrong";
                    }
                    fillGrid();
                    clear();
                }
                else
                {
                    divAlert.Visible   = true;
                    divAlert.InnerHtml = "Enter all required fileds";
                }
            }
            catch
            {
            }
        }
Exemple #28
0
        public int DeleteCategory(clsCategory objClsCategory)
        {
            try
            {
                int            noOfRowsDeleted = 0;
                SqlParameter[] sqlParams       = new SqlParameter[1];
                sqlParams[0]           = new SqlParameter("@CategoryID", SqlDbType.Int, 4);
                sqlParams[0].Value     = objClsCategory.CategoryID;
                sqlParams[0].Direction = ParameterDirection.Input;
                noOfRowsDeleted        = SqlHelper.ExecuteNonQuery(strConnectionString, CommandType.StoredProcedure, "sp_DeleteCategory", sqlParams);
                return(noOfRowsDeleted);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLCategory.cs", "DeleteCategory", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string Bef_sh  = "";
                string Aftr_Sh = "";
                string Erl     = "";
                string Lt      = "";

                if (ChkAllowed.Checked == true)
                {
                    Bef_sh  = Bef_Shft.Text;
                    Aftr_Sh = Aft_shft.Text;
                }
                else
                {
                    Bef_sh  = null;
                    Aftr_Sh = null;
                }

                if (Erl_Alwd.Text == "")
                {
                    Erl = null;
                }
                else
                {
                    Erl = Erl_Alwd.Text;
                }

                if (Lt_Alwd.Text == "")
                {
                    Lt = null;
                }
                else
                {
                    Lt = Lt_Alwd.Text;
                }

                clsCategory objData = new clsCategory();
                objData.CatID                         = ddlCategory.SelectedValue;
                objData.EarlyGoing                    = Erl;
                objData.LateComing                    = Lt;
                objData.CatExtraCheck                 = ChkAllowed.Checked == true ? true : false;
                objData.ExtraHrsBeforeShiftHrs        = Bef_sh;
                objData.ExtraHrsAfterShiftHrs         = Aftr_Sh;
                objData.CompensatoryCode              = Comp_Sts.Text.Trim();
                objData.CatDeductedFromExtHrsEarlyGng = ErlD.Checked == true ? true : false;
                objData.CatDeductedFromExtHrsLateCmg  = LtD.Checked == true ? true : false;
                objData.CreatedBy                     = Session["uid"].ToString();
                if (ViewState["PageMode"].ToString() != "Modify")
                {
                    clsCategoryMasterViewHandler.UpdateUserDetails(objData, "Insert", "", ref strErrMsg, ref strSuccMsg, clsCommonHandler.PageName());
                    if (strErrMsg.Length >= 1)
                    {
                        lblMessageAdd.Text    = strErrMsg;
                        lblMessageAdd.Visible = true;
                        return;
                    }
                    else
                    {
                        lblMessageAdd.Text        = strSuccMsg;
                        ddlCategory.SelectedIndex = 0;
                        Erl_Alwd.Text             = "";
                        Lt_Alwd.Text       = "";
                        Bef_Shft.Text      = "";
                        Aft_shft.Text      = "";
                        Comp_Sts.Text      = "";
                        ChkAllowed.Checked = false;
                        ChkW1.Checked      = false;
                        ChkW2.Checked      = false;
                        ChkHO.Checked      = false;
                        ChkWD.Checked      = false;
                        ErlD.Checked       = false;
                        LtD.Checked        = false;
                        ScriptManager.RegisterClientScriptBlock(updatepanel4, updatepanel4.GetType(), "Script", "validateChosen();", true);
                        mpeAddCategory.Show();
                    }
                }
                else
                {
                    clsCategoryMasterViewHandler.UpdateUserDetails(objData, "Update", "", ref strErrMsg, ref strSuccMsg, clsCommonHandler.PageName());
                    if (strErrMsg.Trim().Length >= 1)
                    {
                        lblMessages.Text = strErrMsg;
                    }
                    else
                    {
                        ddlCategory.SelectedIndex = 0;
                        Erl_Alwd.Text             = "";
                        Lt_Alwd.Text       = "";
                        Bef_Shft.Text      = "";
                        Aft_shft.Text      = "";
                        Comp_Sts.Text      = "";
                        ChkAllowed.Checked = false;
                        ChkW1.Checked      = false;
                        ChkW2.Checked      = false;
                        ChkHO.Checked      = false;
                        ChkWD.Checked      = false;
                        ErlD.Checked       = false;
                        LtD.Checked        = false;
                        mpeAddCategory.Hide();
                        lblMessages.Text = strSuccMsg;
                    }
                }


                bindDataGrid();
            }

            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
        protected void Modify_Data(string CATID)
        {
            try
            {
                clsCategory objData = clsCategoryMasterViewHandler.GetCategoryDetails("All", Convert.ToInt16(CATID));

                if (objData != null)
                {
                    ddlCategory.SelectedValue = objData.CatID;
                    ddlCategory.Visible       = true;
                    ddlCategory.Enabled       = false;

                    if (objData.EarlyGoing == "" || objData.EarlyGoing == "00:00")
                    {
                        Erl_Alwd.Text = "";
                    }
                    else
                    {
                        Erl_Alwd.Text = objData.EarlyGoing.ToString();
                    }
                    if (objData.LateComing == "" || objData.LateComing == "00:00")
                    {
                        Lt_Alwd.Text = "";
                    }
                    else
                    {
                        Lt_Alwd.Text = objData.LateComing.ToString();
                    }

                    if (objData.CatExtraCheck == true)
                    {
                        ChkAllowed.Checked = true;
                        Bef_Shft.Enabled   = true;
                        Aft_shft.Enabled   = true;
                        ErlD.Enabled       = true;
                        LtD.Enabled        = true;
                    }
                    else
                    {
                        ChkAllowed.Checked = false;
                        Bef_Shft.Enabled   = false;
                        Aft_shft.Enabled   = false;
                        ErlD.Enabled       = false;
                        LtD.Enabled        = false;
                    }
                    if (objData.ExtraHrsBeforeShiftHrs == "" || objData.EarlyGoing == "00:00")
                    {
                        Bef_Shft.Text = "";
                    }
                    else
                    {
                        Bef_Shft.Text = objData.ExtraHrsBeforeShiftHrs;
                    }
                    if (objData.ExtraHrsAfterShiftHrs == null || objData.EarlyGoing == "00:00")
                    {
                        Aft_shft.Text = "";
                    }
                    else
                    {
                        Aft_shft.Text = objData.ExtraHrsAfterShiftHrs;
                    }
                    Comp_Sts.Text = objData.CompensatoryCode;
                    if (objData.CompensatoryCode != "")
                    {
                        string Str = objData.CompensatoryCode;
                        if (Str.Contains("W1"))
                        {
                            ChkW1.Checked = true;
                        }
                        if (Str.Contains("W2"))
                        {
                            ChkW2.Checked = true;
                        }
                        if (Str.Contains("HO"))
                        {
                            ChkHO.Checked = true;
                        }
                        if (Str.Contains("WD"))
                        {
                            ChkWD.Checked = true;
                        }
                    }

                    if (objData.CatDeductedFromExtHrsEarlyGng == true)
                    {
                        ErlD.Checked = true;
                    }
                    else
                    {
                        ErlD.Checked = false;
                    }
                    if (objData.CatDeductedFromExtHrsLateCmg == true)
                    {
                        LtD.Checked = true;
                    }
                    else
                    {
                        LtD.Checked = false;
                    }
                }
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }