コード例 #1
0
        public FTSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FTID)
        {
            FTSerEditResult ret = null;

            ret = _client.GetEntityByID(entity_WCFAuthInfoVM, str_FTID);
            return(ret);
        }
        public FTSerEditResult GetEmptyFTVM(WCFAuthInfoVM entity_WCFAuthInfoVM)
        {
            try
            {
                //Restore Server Session by token
                RetrieveServerSideSession(entity_WCFAuthInfoVM);

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

                FTSerEditResult returnResult = new FTSerEditResult();

                bool ret = false;

                ret = CheckTokenOnly(entity_BaseSession, ref strList_Error);

                if (ret)
                {
                    returnResult.Entity_FunctionTypeVM = new FunctionTypeVM();
                }

                returnResult.StrList_Error = strList_Error;

                return(returnResult);
            }
            catch (Exception ex)
            {
                throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed);
            }
        }
コード例 #3
0
        public ActionResult Edit(string guid)
        {
            //Message Box Title -- When Error occured, Message Box would be showed.
            string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "FTManage_Edit");

            string strError = "";

            //Define wcf output object;
            FTSerEditResult entity_Return = new FTSerEditResult();

            //Call WCF Service
            WebCommonHelper webCommonHelper = new WebCommonHelper();

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

            if (entity_Return.StrList_Error.Count > 0 || entity_Return.Entity_FunctionTypeVM == 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;

                FunctionTypeVM selectionCriteria = new FunctionTypeVM();

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

                TempData[SelectionCriteriaKey] = selectionCriteria;

                TempData[ActionMessageKey] = errorMsgInfo;
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(entity_Return.Entity_FunctionTypeVM));
            }
        }
        public FTSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FTID)
        {
            try
            {
                //Retrieve Language And Session
                RetrieveLanguageAndSession(entity_WCFAuthInfoVM);

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

                FTSerEditResult returnResult = new FTSerEditResult();

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

                FunctionTypeRespository Respo_FT = new FunctionTypeRespository(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("FTManage", "Edit", "", null);
                bool allowDel  = entity_BaseSession.CheckAccessRight("FTManage", "Delete", "", null);

                if (ret)
                {
                    FunctionTypeVM db_FunctionTypeVM = Respo_FT.GetEntityByID(Guid.Parse(str_FTID), languageKey, out strList_Error);

                    db_FunctionTypeVM.AllowDel  = allowDel;
                    db_FunctionTypeVM.AllowEdit = allowEdit;

                    returnResult.Entity_FunctionTypeVM = db_FunctionTypeVM;
                }

                returnResult.StrList_Error = strList_Error;

                return(returnResult);
            }
            catch (Exception ex)
            {
                throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed);
            }
        }
コード例 #5
0
        public FTSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FTID)
        {
            try
            {
                //Retrieve Language And Session
                RetrieveLanguageAndSession(entity_WCFAuthInfoVM);

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

                FTSerEditResult returnResult = new FTSerEditResult();

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

                FunctionTypeRespository Respo_FT = new FunctionTypeRespository(dbContext, entity_BaseSession.ID);

                bool ret = false;

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

                if (ret)
                {
                    FunctionTypeVM db_FunctionTypeVM = Respo_FT.GetEntityByID(Guid.Parse(str_FTID), languageKey, out strList_Error);

                    returnResult.Entity_FunctionTypeVM = db_FunctionTypeVM;
                }

                returnResult.StrList_Error = strList_Error;

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