示例#1
0
        public override ActionResult EditMasterDataByID(int id)
        {
            operationMode = OperationMode.EditModify;
            ac            = new a_PageContext()
            {
                Connection = getSQLConnection(), logPlamInfo = plamInfo
            };;

            RunOneDataEnd <m_PageContext> HResult = ac.GetDataMaster(id, LoginUserId);

            md          = HResult.SearchData;
            md.EditType = EditModeType.Modify;
            HandleResultCheck(HResult);
            HandleCollectDataToOptions();

            ViewBag.Caption = GetSystemInfo().prog_name;

            HandleRequest HRq = new HandleRequest(); //記錄QueryString

            HRq.Remove("id");                        //不需記ID
            ViewBag.QueryString = HRq.ToQueryString();
            HRq = null;

            return(View("EditData", md));
        }
        public override ActionResult EditMasterDataByID(int id)
        {
            #region GetKinds
            //gg
            a_ProductKind c = new a_ProductKind()
            {
                Connection = getSQLConnection(), logPlamInfo = plamInfo
            };
            RunQueryPackage <m_ProductKind> hResult = c.SearchMaster(new q_ProductKind(), LoginUserId);
            HandleResultCheck(hResult);
            List <SelectListItem> New_Kinds    = new List <SelectListItem>();
            List <SelectListItem> Second_Kinds = new List <SelectListItem>();
            #endregion

            operationMode = OperationMode.EditModify;
            ac            = new a_ProductData()
            {
                Connection = getSQLConnection(), logPlamInfo = plamInfo
            };

            RunOneDataEnd <m_ProductData> HResult = ac.GetDataMaster(id, LoginUserId);
            md = HResult.SearchData;

            int sid = hResult.SearchData.Where(m_ProductData => m_ProductData.ID == md.Kind).First().Series;
            foreach (var item in hResult.SearchData.Where(x => x.Series == sid))
            {
                if (item.IsSecond == true)
                {
                    Second_Kinds.Add(new SelectListItem()
                    {
                        Text = item.Name, Value = item.ID.ToString()
                    });
                }
                else
                {
                    New_Kinds.Add(new SelectListItem()
                    {
                        Text = item.Name, Value = item.ID.ToString()
                    });
                }
            }
            ViewBag.NewKind_Option    = New_Kinds;
            ViewBag.SecondKind_Option = Second_Kinds;

            md.Series   = sid;
            md.EditType = EditModeType.Modify;
            HandleResultCheck(HResult);
            HandleCollectDataToOptions();

            ViewBag.Caption = GetSystemInfo().prog_name;

            HandleRequest HRq = new HandleRequest(); //記錄QueryString
            HRq.Remove("id");                        //不需記ID
            ViewBag.QueryString = HRq.ToQueryString();
            ViewBag.id          = id;
            HRq = null;

            return(View("EditData", md));
        }
示例#3
0
        protected ReturnAjaxData HandleResultAjaxData <m>(RunOneDataEnd <m> h, String ReturnTrueMessage) where m : ModuleBase
        {
            ReturnAjaxData r = new ReturnAjaxData();

            if (!h.Result)
            {
                if (h.ErrType == BusinessErrType.Logic)
                {
                    r.result  = false;
                    r.message = GetRecMessage(h.Message);;
                    r.title   = Resources.Res.Log_Err_Title;
                    r.errtype = ReturnErrType.Logic;
                }

                if (h.ErrType == BusinessErrType.System)
                {
                    r.result  = false;
                    r.message = h.Message;
                    r.title   = Resources.Res.Sys_Err_Title;
                    r.errtype = ReturnErrType.System;
                }
            }
            else
            {
                r.result = true;
                r.data   = h.SearchData;
                if (h.Message == "")
                {
                    r.message = ReturnTrueMessage;
                }

                else
                {
                    r.title   = Resources.Res.Info_SystemAlert;
                    r.message = GetRecMessage(h.Message);;
                }
            }
            return(r);
        }