Beispiel #1
0
        public FSerEditResult GetEmptyFVM(WCFAuthInfoVM entity_WCFAuthInfoVM)
        {
            try
            {
                //Restore Server Session by token
                RetrieveServerSideSession(entity_WCFAuthInfoVM);

                List <string> strList_Error = new List <string>();

                FSerEditResult returnResult = new FSerEditResult();

                bool ret = false;

                ret = CheckTokenOnly(entity_BaseSession, ref strList_Error);

                if (ret)
                {
                    returnResult.Entity_FunctionVM = new FunctionVM();
                }

                returnResult.StrList_Error = strList_Error;

                return(returnResult);
            }
            catch (Exception ex)
            {
                throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed);
            }
        }
        public FSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FunID)
        {
            FSerEditResult ret = null;

            ret = _client.GetEntityByID(entity_WCFAuthInfoVM, str_FunID);
            return(ret);
        }
Beispiel #3
0
        public ActionResult Edit(string guid)
        {
            //Message Box Title -- When Error occured, Message Box would be showed.
            string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "FManage_Edit");

            string strError = "";

            FSerEditResult  entity_Return   = new FSerEditResult();
            WebCommonHelper webCommonHelper = new WebCommonHelper();

            webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) =>
            {
                entity_Return = funMgtHelper.Value.GetEntityByID(entity_WCFAuthInfoVM, guid);
            });

            if (entity_Return.StrList_Error.Count > 0 || entity_Return.Entity_FunctionVM == null)
            {
                if (entity_Return.StrList_Error.Count() > 0)
                {
                    strError = string.Join("<br/>", entity_Return.StrList_Error.ToArray());
                }

                MsgInfo errorMsgInfo = new MsgInfo();
                errorMsgInfo.MsgTitle = str_MsgBoxTitle;
                errorMsgInfo.MsgDesc  = strError;
                errorMsgInfo.MsgType  = MessageType.ValidationError;

                FunctionVM selectionCriteria = new FunctionVM();

                if (TempData.ContainsKey(SelectionCriteriaKey))
                {
                    selectionCriteria = (FunctionVM)TempData[SelectionCriteriaKey];
                }

                TempData[SelectionCriteriaKey] = selectionCriteria;

                TempData[ActionMessageKey] = errorMsgInfo;
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(entity_Return.Entity_FunctionVM));
            }
        }
Beispiel #4
0
        public FSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FunID)
        {
            try
            {
                //Retrieve Language And Session
                RetrieveLanguageAndSession(entity_WCFAuthInfoVM);

                List <string> strList_Error = new List <string>();

                FSerEditResult returnResult = new FSerEditResult();

                //Contruct Login User Respository
                CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext();

                FunctionRespository Respo_F = new FunctionRespository(dbContext, entity_BaseSession.ID);

                bool ret = false;

                ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error);

                bool allowEdit = entity_BaseSession.CheckAccessRight(entity_WCFAuthInfoVM.RequestFunKey, "Edit", "", null);
                bool allowDel  = entity_BaseSession.CheckAccessRight(entity_WCFAuthInfoVM.RequestFunKey, "Delete", "", null);


                if (ret)
                {
                    FunctionVM db_FunctionVM = Respo_F.GetEntityByID(Guid.Parse(str_FunID), languageKey, ref strList_Error);

                    db_FunctionVM.AllowEdit = allowEdit;
                    db_FunctionVM.AllowDel  = allowDel;

                    returnResult.Entity_FunctionVM = db_FunctionVM;
                }

                returnResult.StrList_Error = strList_Error;

                return(returnResult);
            }
            catch (Exception ex)
            {
                throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed);
            }
        }
        public FSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FunID)
        {
            try
            {
                //Retrieve Language And Session
                RetrieveLanguageAndSession(entity_WCFAuthInfoVM);



                List <string> strList_Error = new List <string>();

                FSerEditResult returnResult = new FSerEditResult();

                //Contruct Login User Respository
                CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext();

                FunctionRespository Respo_F = new FunctionRespository(dbContext, entity_BaseSession.ID);

                bool ret = false;

                ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error);

                if (ret)
                {
                    FunctionVM db_FunctionVM = Respo_F.GetEntityByID(Guid.Parse(str_FunID), languageKey, ref strList_Error);

                    returnResult.Entity_FunctionVM = db_FunctionVM;
                }

                returnResult.StrList_Error = strList_Error;

                return(returnResult);
            }
            catch (Exception ex)
            {
                throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message);
            }
        }