/// <summary>
        /// Add application category
        /// </summary>
        /// <returns></returns>
        public PartialViewResult PartialAddApplicationCategory()
        {
            ApplicationCategoryViewModel oApplicationCategoryViewModel = new ApplicationCategoryViewModel();

            oApplicationCategoryViewModel.APPLICATION_ID = CurrentApplicationID;
            return(PartialView("_AddApplicationCategory", oApplicationCategoryViewModel));
        }
        public JsonResult JEditApplicationCategory(ApplicationCategoryViewModel oApplicationCategoryViewModel)
        {
            Response oResponseResult = null;

            oApplicationCategoryViewModel.MODIFIED_BY = Convert.ToInt32(CurrentUser.nUserID);

            oResponseResult      = this.oIApplicationCategoryServices.oUpdateApplicationCategory(oApplicationCategoryViewModel);
            this.OperationResult = oResponseResult.OperationResult;

            switch (this.OperationResult)
            {
            case enumOperationResult.Success:
                this.OperationResultMessages = CommonResx.MessageEditSuccess;
                break;

            case enumOperationResult.Faild:
                this.OperationResultMessages = CommonResx.MessageEditFailed;
                break;
            }
            return(Json(
                       new
            {
                nResult = this.OperationResult,
                sResultMessages = this.OperationResultMessages
            },
                       JsonRequestBehavior.AllowGet));
        }
        public JsonResult JSaveApplicationCategory(ApplicationCategoryViewModel oApplicationCategoryViewModel)
        {
            Response oResponseResult = null;

            oApplicationCategoryViewModel.CREATED_BY  = Convert.ToInt32(CurrentUser.nUserID);
            oApplicationCategoryViewModel.LANGUAGE_ID = Convert.ToInt32(this.CurrentApplicationLanguage);

            oResponseResult      = this.oIApplicationCategoryServices.oInsertApplicationCategory(oApplicationCategoryViewModel);
            this.OperationResult = oResponseResult.OperationResult;

            switch (this.OperationResult)
            {
            case enumOperationResult.Success:
                this.OperationResultMessages = CommonResx.MessageAddSuccess;
                break;

            case enumOperationResult.AlreadyExistRecordFaild:
                this.OperationResultMessages = CommonResx.AlreadyExistRecordFaild;
                break;

            case enumOperationResult.Faild:
                this.OperationResultMessages = CommonResx.MessageAddFailed;
                break;
            }
            return(Json(
                       new
            {
                nResult = this.OperationResult,
                sResultMessages = this.OperationResultMessages
            },
                       JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        /// <summary>
        ///  Insert application category
        /// </summary>
        /// <param name="oApplicationCategoryViewModel"></param>
        /// <returns>Response</returns>
        public Response oInsertApplicationCategory(ApplicationCategoryViewModel oApplicationCategoryViewModel)
        {
            #region ": Insert :"

            Response oResponse = new Response();

            try
            {
                if (oApplicationCategoryViewModel != null)
                {
                    var lstApplicationCategory = (from c in this.ApplicationCategoryDBSet
                                                  where c.APPLICATION_ID == oApplicationCategoryViewModel.APPLICATION_ID
                                                  where c.LANGUAGE_ID == oApplicationCategoryViewModel.LANGUAGE_ID
                                                  where c.CATEGORY_NAME == oApplicationCategoryViewModel.CATEGORY_NAME
                                                  orderby c.ID descending
                                                  select new
                    {
                        ID = c.ID,
                        APPLICATION_ID = c.APPLICATION_ID,
                        CATEGORY_NAME = c.CATEGORY_NAME
                    });
                    if (lstApplicationCategory.Count() > 0)
                    {
                        oResponse.OperationResult = enumOperationResult.AlreadyExistRecordFaild;
                        return(oResponse);
                    }

                    APPLICATION_CATEGORIES oAPPLICATION_CATEGORIES = new APPLICATION_CATEGORIES()
                    {
                        APPLICATION_ID = oApplicationCategoryViewModel.APPLICATION_ID,
                        LANGUAGE_ID    = oApplicationCategoryViewModel.LANGUAGE_ID,
                        CATEGORY_NAME  = oApplicationCategoryViewModel.CATEGORY_NAME,
                        CREATED_BY     = oApplicationCategoryViewModel.CREATED_BY,
                        CREATED_DATE   = DateTime.Now
                    };
                    this.oTakamulConnection.APPLICATION_CATEGORIES.Add(oAPPLICATION_CATEGORIES);
                    if (this.intCommit() > 0)
                    {
                        oResponse.OperationResult = enumOperationResult.Success;
                    }
                    else
                    {
                        oResponse.OperationResult = enumOperationResult.Faild;
                    }
                }
            }
            catch (Exception Ex)
            {
                oResponse.OperationResult = enumOperationResult.Faild;
                //TODO : Log Error Message
                oResponse.OperationResultMessage = Ex.Message.ToString();
            }

            return(oResponse);

            #endregion
        }
Exemple #5
0
        /// <summary>
        /// Update application category
        /// </summary>
        /// <param name="oApplicationCategoryViewModel"></param>
        /// <returns>Response</returns>
        public Response oUpdateApplicationCategory(ApplicationCategoryViewModel oApplicationCategoryViewModel)
        {
            Response oResponse = new Response();

            #region Try Block

            try
            {
                // Start try

                #region Check oApplicationCategoryViewModel Value
                APPLICATION_CATEGORIES oAPPLICATION_CATEGORIES = new APPLICATION_CATEGORIES();
                oAPPLICATION_CATEGORIES = this.oTakamulConnection.APPLICATION_CATEGORIES.Find(oApplicationCategoryViewModel.ID);

                if (oAPPLICATION_CATEGORIES == null)
                {
                    throw new ArgumentNullException("APPLICATION_CATEGORIES Entity Is Null");
                }

                #endregion

                #region Update Default APPLICATION_CATEGORIES

                oAPPLICATION_CATEGORIES.APPLICATION_ID = oApplicationCategoryViewModel.APPLICATION_ID;
                oAPPLICATION_CATEGORIES.CATEGORY_NAME  = oApplicationCategoryViewModel.CATEGORY_NAME;
                oAPPLICATION_CATEGORIES.MODIFIED_BY    = oApplicationCategoryViewModel.CREATED_BY;
                oAPPLICATION_CATEGORIES.MODIFIED_DATE  = DateTime.Now;
                this.ApplicationCategoryDBSet.Attach(oAPPLICATION_CATEGORIES);
                this.oTakamulConnection.Entry(oAPPLICATION_CATEGORIES).State = EntityState.Modified;

                if (this.intCommit() > 0)
                {
                    oResponse.OperationResult = enumOperationResult.Success;
                }
                else
                {
                    oResponse.OperationResult = enumOperationResult.Faild;
                }
                #endregion
            }// End try
            #endregion

            #region Catch Block
            catch (Exception Ex)
            {// Start Catch
                oResponse.OperationResult = enumOperationResult.Faild;
                //TODO : Log Error Message
                oResponse.OperationResultMessage = Ex.Message.ToString();
            }//End Catch
            #endregion

            return(oResponse);
        }
Exemple #6
0
 public ActionResult EditCategory(ApplicationCategoryViewModel appCategory)
 {
     if (ModelState.IsValid)
     {
         ApplicationCategory mode = new ApplicationCategory
         {
             ApplicationCategoryId = appCategory.ApplicationCategoryId,
             ApplicationName       = appCategory.ApplicationName
         };
         db.Entry(mode).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(appCategory));
 }
Exemple #7
0
        public ActionResult AddApplicationCategory(ApplicationCategoryViewModel vModel)
        {
            if (ModelState.IsValid)
            {
                ApplicationCategory model = new ApplicationCategory
                {
                    ApplicationCategoryId = Guid.NewGuid(),
                    ApplicationName       = vModel.ApplicationName
                };

                db.ApplicationCategories.Add(model);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vModel));
        }
 /// <summary>
 ///  Edit application category
 /// </summary>
 /// <param name="oApplicationCategoryViewModel"></param>
 /// <returns></returns>
 public PartialViewResult PartialEditApplicationCategory(ApplicationCategoryViewModel oApplicationCategoryViewModel)
 {
     oApplicationCategoryViewModel.APPLICATION_ID = CurrentApplicationID;
     return(PartialView("_EditApplicationCategory", oApplicationCategoryViewModel));
 }