Exemplo n.º 1
0
 public ActionResult GetUserFriends()
 {
     var result = new TResult<List<UsersEntity>>();
     UsersBLL userBLL = new UsersBLL();
     if (CurrentUser!=null)
     {
         var friendList = userBLL.GetFriendUsersListByUserId(null,  CurrentUser.Id);
         result = friendList;
     }
     return Json(result);
 }
Exemplo n.º 2
0
        public ActionResult Room(string id)
        {
            var model = new TResult<UsersEntity>();

            if (!string.Empty.Equals(id))
            {
                Guid userId = new Guid(id);
                UsersBLL bll = new UsersBLL();
                model = bll.GetUsersEntityByID(userId, null);
            }

            return View(model);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据nickName查询数据
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="tran">事务</param>
        /// <returns>对象实体</returns>
        public TResult<int> ExistFriend(Guid userId, Guid friendId)
        {
            TResult<int> result = new TResult<int>();

            int i = Convert.ToInt32(UsersFriendDAL.ExistFriend(userId, friendId, null));
            if (i > 0)
            {
                result.IsSuccess = true;
                result.Message = "已经存在!";
                return result;
            }
            result.IsSuccess = false;
            result.TData = i;
            return result;
        }
Exemplo n.º 4
0
 public ActionResult GetRecords()
 {
     var list = new List<Entity.SpeechInfoPart>();
     SpeechInfoBLL bll = new SpeechInfoBLL();
     StringBuilder sb = new StringBuilder();
     var result = new TResult<List<SpeechInfoPart>>();
     if (!Guid.Empty.Equals(WorkContext.Uid))
     {
         result = bll.GetSpeechInfoListByFromId(WorkContext.Uid, null);
         if (result.IsSuccess && result.TData.Count > 0)
         {
             list = result.TData;
         }
     }
     return Json(result);
 }
Exemplo n.º 5
0
        /// <summary>
        /// 根据nickName查询数据
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="tran">事务</param>
        /// <returns>对象实体</returns>
        public TResult<int> GetListByNickName(string nickName)
        {
            TResult<int> result = new TResult<int>();

            int i = Convert.ToInt32(UsersDAL.GetListByNickName(nickName, null));
            if (i > 0)
            {
                result.IsSuccess = false;
                result.Message = "昵称已经存在!";
                return result;
            }

            result.IsSuccess = true;
            result.TData = i;
            result.Message = "获取成功";
            return result;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 根据Email获取实体
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="tran">事务</param>
        /// <returns>对象实体</returns>
        public TResult<UsersEntity> GetUsersEntityByEmail(string email, SqlTransaction tran)
        {
            TResult<UsersEntity> result = new TResult<UsersEntity>();

            UsersEntity entity = UsersDAL.GetUsersEntityByEmail(email, tran);
            if (entity == null)
            {
                result.IsSuccess = false;
                result.Message = "不存在";
                return result;
            }

            result.IsSuccess = true;
            result.TData = entity;
            result.Message = "获取成功";
            return result;
        }
Exemplo n.º 7
0
        /// <summary>
        /// 根据userid获取全部对象
        /// </summary>
        /// <param name="tran">事务</param>
        /// <returns>对象实体</returns>
        public TResult<List<SpeechInfoPart>> GetSpeechInfoListByFromId(Guid fromUser, SqlTransaction tran)
        {
            TResult<List<SpeechInfoPart>> result = new TResult<List<SpeechInfoPart>>();

            List<SpeechInfoPart> list = SpeechInfoDAL.GetSpeechInfoListByFromId(fromUser, tran);
            if (list == null)
            {
                result.IsSuccess = false;
                result.Message = "不存在";

                return result;
            }

            result.IsSuccess = true;
            result.TData = list;
            result.Message = "获取成功";
            return result;
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取全部对象
        /// </summary>
        /// <param name="tran">事务</param>
        /// <returns>对象实体</returns>
        public TResult<List<UsersFriendEntity>> GetUsersFriendListByUserId(SqlTransaction tran, Guid userId)
        {
            TResult<List<UsersFriendEntity>> result = new TResult<List<UsersFriendEntity>>();

            List<UsersFriendEntity> list = UsersFriendDAL.GetUsersFriendListByUserId(userId, tran);
            if (list == null)
            {
                result.IsSuccess = false;
                result.Message = "不存在";

                return result;
            }

            result.IsSuccess = true;
            result.TData = list;
            result.Message = "获取成功";
            return result;
        }
Exemplo n.º 9
0
		/// <summary>
        /// 根据编号获取实体
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="tran">事务</param>
		/// <returns>对象实体</returns>
		public TResult< UsersFriendEntity> GetUsersFriendEntityByID(Guid id, SqlTransaction tran)
		{
            TResult< UsersFriendEntity> result = new TResult< UsersFriendEntity>();
            
             UsersFriendEntity entity =  UsersFriendDAL.GetUsersFriendEntityByID(id, tran);
            if (entity == null)
            {
                result.IsSuccess = false;
                result.Message = "不存在";

                return result;
            }

            result.IsSuccess = true;
            result.TData = entity;
            result.Message = "获取成功";
            return result;
		}
Exemplo n.º 10
0
        /// <summary>
        /// 获取好友列表
        /// </summary>
        /// <param name="tran"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public TResult<List<UsersEntity>> GetFriendUsersListByUserId(SqlTransaction tran, Guid userId)
        {
            TResult<List<UsersEntity>> result = new TResult<List<UsersEntity>>();

            List<UsersEntity> list = UsersDAL.GetFriendUsersListByUserId(userId, tran);
            if (list == null)
            {
                result.IsSuccess = false;
                result.Message = "不存在";

                return result;
            }

            result.IsSuccess = true;
            result.TData = list.OrderByDescending(s=>s.IsHasNews).OrderByDescending(s=>s.IsOnline).ToList();
            result.Message = "获取成功";
            return result;
        }
Exemplo n.º 11
0
        public override RowsetBase Execute(ICRUDQueryExecutionContext context, Query query, bool oneRow = false)
        {
            var ctx = (MongoDBCRUDQueryExecutionContext)context;

              NFX.DataAccess.MongoDB.Connector.Collection collection;
              var qry = MakeQuery(ctx.Database, query, out collection);

              var rrow = new TResult();

              var sw = Stopwatch.StartNew();

              rrow.Count = collection.Count(qry);//Performs server-side count over query

              rrow.Interval = sw.Elapsed;

              var result = new Rowset(Schema.GetForTypedRow(typeof(TResult)));
              result.Add(rrow);
              return result;
        }
Exemplo n.º 12
0
 internal sealed override void TrySetSucceeded(out State state, out Func <bool> postscript, TResult result)
 {
     state      = this;
     postscript = () => false;
 }
        public void First_Create_AppName_Ios_Android_Is_Default_Value()
        {
            //Arrange
            _appListService.GetAppName(_appID).Returns(_wisAppList);
            _appListService.GetAppOs(_appID).Returns(_wisAppOs);
            _uploadFileService.GetPhotos(_appID).Returns(_wisAppPhoto);
            _appListService.GetDefineGroup(Arg.Any <List <string> >()).Returns(_wisDefineGroup);

            TResult <AppEditViewModel> expectedResponse = new TResult <AppEditViewModel>
            {
                data = new AppEditViewModel
                {
                    AppName = new AppNameCreate
                    {
                        AppID            = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        IsTop            = true,
                        CompanyApp       = true,
                        AppName          = "Test AppName",
                        AppNameEn        = "Test AppName",
                        Development      = "MCP.Devloper",
                        Email            = "*****@*****.**",
                        Category         = "wistron App",
                        DescriptionCh    = "App說明-中文",
                        DescriptionEn    = "App說明-英文",
                        AppOpen          = true,
                        AppUserGroup     = "1,2",
                        AppUserGroupName = "WZS All users,ML10-Dept"
                    },
                    AppIos = new AppOsInfo
                    {
                        AppID        = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppOSID      = 3,
                        OSType       = OsType.Ios,
                        AppName      = "Test AppName",
                        AppNameEn    = "Test AppName",
                        Status       = true,
                        AppOsHistory = new List <AppOsInfo>(),
                        Photo        = new List <AppPhotoContent>()
                    },
                    AppAndroid = new AppOsInfo
                    {
                        AppID        = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppOSID      = 4,
                        OSType       = OsType.Android,
                        AppName      = "Test AppName",
                        AppNameEn    = "Test AppName",
                        Status       = true,
                        AppOsHistory = new List <AppOsInfo>(),
                        Photo        = new List <AppPhotoContent>()
                    }
                },
                Rtncode = FaultInfoRcConstants.OK,
                RtnMsg  = "OK"
            };

            //Act
            TResult <AppEditViewModel> actualResponse = _targetObj.GetCreateAndEditApp(_appID, _appOsID, _appOsType);

            //Assert
            Assert.AreEqual(expectedResponse.Rtncode, actualResponse.Rtncode);
            Assert.AreEqual(expectedResponse.RtnMsg, actualResponse.RtnMsg);
            Assert.AreEqual(expectedResponse.data.AppName.AppID, actualResponse.data.AppName.AppID);
            // check the user group
            Assert.AreEqual(expectedResponse.data.AppName.AppUserGroupName, actualResponse.data.AppName.AppUserGroupName);
        }
Exemplo n.º 14
0
		/// <summary>
        /// 获取全部对象
        /// </summary>
        /// <param name="tran">事务</param>
		/// <returns>对象实体</returns>
		public TResult<List< SpeechInfoEntity>> GetAllSpeechInfoList(string key,string city,SqlTransaction tran)
		{
            TResult<List< SpeechInfoEntity>> result = new TResult<List< SpeechInfoEntity>>();

            List<SpeechInfoEntity> list = SpeechInfoDAL.GetAllSpeechInfoList(key,city, tran);
            if (list == null)
            {
                result.IsSuccess = false;
                result.Message = "不存在";

                return result;
            }

            result.IsSuccess = true;
            result.TData = list;
            result.Message = "获取成功";
            return result;
		}
Exemplo n.º 15
0
        private async Task <TResult> ShowHostedDialog <TControl, TViewModel, TResult>()
            where TViewModel : class
            where TResult : class
            where TControl : UserControl, new()
        {
            var ctrl = new TControl();
            var vm   = ctrl.DataContext as TViewModel;

            bool             newHost = false;
            DialogWindowHost host    = CurrentDialogHost;

            if (host == null)
            {
                host = new DialogWindowHost
                {
                    Owner   = Window,
                    Content = ctrl
                };

                host.Closed += (s, e) =>
                {
                    DialogStack.Clear();
                    CurrentDialogHost = null;
                };

                CurrentDialogHost = host;
                newHost           = true;
            }
            else
            {
                host.Content = ctrl;
            }

            var hostVm = host.DataContext as IDialogHostViewModel;

            Debug.Assert(hostVm != null, "hostVm != null");
            await hostVm.Setup(vm);

            TResult result = null;
            await Dispatcher.RunAsync(() =>
            {
                bool shouldSetupResult = false;

                if (newHost)
                {
                    try
                    {
                        shouldSetupResult = host.ShowDialog() == true;
                    }
                    catch (InvalidOperationException)
                    {
                        // Window was closed during setup
                    }
                }

                if (shouldSetupResult)
                {
                    result = DialogStack.ResultSetup <TViewModel, TResult>(vm);
                }
            });

            return(result);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Executes the scalar.
        /// </summary>
        /// <typeparam name="TResult">The type of the result.</typeparam>
        /// <returns></returns>
        public TResult ExecuteScalar <TResult>()
        {
            TResult result = (TResult)_provider.ExecuteScalar(_command).ChangeTypeTo <TResult>();

            return(result);
        }
Exemplo n.º 17
0
        public ActionResult MyShop1(int id)
        {
            double pageCount = (double)(BuildFactory.GoodsFactory().Count(id)) / 12;//每页10
            pageCount = Math.Ceiling(pageCount);
            ViewBag.PageCout = pageCount;//一共多少页

            ViewBag.Count = BuildFactory.GoodsFactory().Count(id);
            Session["stroeid"] = id;

            ViewBag.count = BuildFactory.AppylyStroeFactory().QueryShop().Count;

            var str = string.Empty;
            var city = string.Empty;
            if (Request["key"] != null)
            {
                str = Request["key"];
            }
            if (Request["c"] != null)
            {
                city = Request["c"];
            }
            var result = new TResult<List<Entity.SpeechInfoEntity>>();
            SpeechInfoBLL bll = new SpeechInfoBLL();
            ViewBag.Citys = citys;
            result = bll.GetAllSpeechInfoList(str, city, null);

            ;

            return View(result);
        }
        public void Get_Edit_Android_And_IOS_Status_Is_True()
        {
            //Arrange
            _appOsID   = "8";
            _appOsType = "Android";
            _appListService.GetAppName(_appID).Returns(_wisAppList);
            _appListService.GetAppOs(_appID).Returns(_wisAppOs);
            _uploadFileService.GetPhotos(_appID).Returns(_wisAppPhoto);
            _appListService.GetDefineGroup(Arg.Any <List <string> >()).Returns(_wisDefineGroup);
            TResult <AppEditViewModel> expectedResponse = new TResult <AppEditViewModel>
            {
                data = new AppEditViewModel
                {
                    AppName = new AppNameCreate
                    {
                        AppID            = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        IsTop            = true,
                        CompanyApp       = true,
                        AppName          = "Test AppName",
                        AppNameEn        = "Test AppName",
                        Development      = "MCP.Devloper",
                        Email            = "*****@*****.**",
                        Category         = "wistron App",
                        DescriptionCh    = "App說明-中文",
                        DescriptionEn    = "App說明-英文",
                        AppOpen          = true,
                        AppUserGroup     = "1,2",
                        AppUserGroupName = "WZS All users,ML10-Dept"
                    },
                    AppIos = new AppOsInfo
                    {
                        AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppOSID       = 2,
                        OSType        = OsType.Ios,
                        AppName       = "Test AppName",
                        AppNameEn     = "Test AppName",
                        PackageName   = "com.wistron.portalapp.dev",
                        Version       = "1,0.1",
                        FileName      = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                        FilePath      = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                        Status        = true,
                        WebDownFlag   = true,
                        DescriptionCh = "版本更新 1.0.1",
                        DescriptionEn = "The version is update 1.0.1",
                        CreateDT      = DateTime.Now,
                        LastUpdateDT  = DateTime.Now,
                        AppOsHistory  = new List <AppOsInfo>
                        {
                            new AppOsInfo
                            {
                                AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                                AppOSID       = 3,
                                OSType        = 1,
                                AppName       = "Test AppName",
                                AppNameEn     = "Test AppName",
                                PackageName   = "com.wistron.portalapp.dev",
                                Version       = "1,0.0",
                                FileName      = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                                FilePath      = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                                Status        = true,
                                WebDownFlag   = true,
                                DescriptionCh = "版本更新 1.0.0",
                                DescriptionEn = "The version is update 1.0.0",
                                CreateDT      = DateTime.Now,
                                LastUpdateDT  = DateTime.Now,
                            }
                        },
                    },
                    AppAndroid = new AppOsInfo
                    {
                        AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppOSID       = 8,
                        OSType        = 1,
                        AppName       = "Test AppName",
                        AppNameEn     = "Test AppName",
                        PackageName   = "com.wistron.portalapp.dev",
                        Version       = "1,0.1",
                        FileName      = "Portal 2.0_20201021(Dev 0.2.2).apk",
                        FilePath      = "PortalApp2.0/Android/Install/0.2.2-9e5f0b8dd1bf467096272cb1c41cca1d.apk",
                        Status        = true,
                        WebDownFlag   = true,
                        DescriptionCh = "版本更新 1.0.1",
                        DescriptionEn = "The version is update 1.0.1",
                        CreateDT      = DateTime.Now,
                        LastUpdateDT  = DateTime.Now,
                        AppOsHistory  = new List <AppOsInfo>
                        {
                            new AppOsInfo
                            {
                                AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                                AppOSID       = 8,
                                OSType        = 2,
                                AppName       = "Test AppName",
                                AppNameEn     = "Test AppName",
                                PackageName   = "com.wistron.portalapp.dev",
                                Version       = "1,0.1",
                                FileName      = "Portal 2.0_20201021(Dev 0.2.2).apk",
                                FilePath      = "PortalApp2.0/Android/Install/0.2.2-9e5f0b8dd1bf467096272cb1c41cca1d.apk",
                                Status        = true,
                                WebDownFlag   = true,
                                DescriptionCh = "版本更新 1.0.1",
                                DescriptionEn = "The version is update 1.0.1",
                                CreateDT      = DateTime.Now,
                                LastUpdateDT  = DateTime.Now,
                            },
                            new AppOsInfo
                            {
                                AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                                AppOSID       = 9,
                                OSType        = 2,
                                AppName       = "Test AppName",
                                AppNameEn     = "Test AppName",
                                PackageName   = "com.wistron.portalapp.dev",
                                Version       = "1.0.0",
                                FileName      = "Portal 2.0_20201021(Dev 0.2.2).apk",
                                FilePath      = "PortalApp2.0/Android/Install/0.2.2-9e5f0b8dd1bf467096272cb1c41cca1d.apk",
                                Status        = true,
                                WebDownFlag   = true,
                                DescriptionCh = "版本更新 1.0.0",
                                DescriptionEn = "The version is update 1.0.0",
                                CreateDT      = DateTime.Now,
                                LastUpdateDT  = DateTime.Now,
                            }
                        },
                        Photo = new List <AppPhotoContent>
                        {
                            new AppPhotoContent
                            {
                                AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                                AppOS      = 2,
                                FileNumber = 5,
                                FileName   = "024abd90fb4c49149156aff2d5fd99ac.png",
                                FilePath   = "PortalApp2.0/Android/Images/024abd90fb4c49149156aff2d5fd99ac.png",
                                PhotoType  = 1 // 1= Icon 圖片 2 = 一般圖片
                            }
                        }
                    }
                },
                Rtncode = FaultInfoRcConstants.OK,
                RtnMsg  = "OK"
            };

            //Act
            TResult <AppEditViewModel> actualResponse = _targetObj.GetCreateAndEditApp(_appID, _appOsID, _appOsType);

            //Assert
            Assert.AreEqual(expectedResponse.Rtncode, actualResponse.Rtncode);
            Assert.AreEqual(expectedResponse.RtnMsg, actualResponse.RtnMsg);
            Assert.AreEqual(expectedResponse.data.AppAndroid.AppOSID, actualResponse.data.AppAndroid.AppOSID);

            //驗證是否如預期 取得 歷史資訊共2筆
            Assert.AreEqual(expectedResponse.data.AppAndroid.AppOsHistory.Count, actualResponse.data.AppAndroid.AppOsHistory.Count);

            //驗證圖片是否有歸類到 對應的 Android = 1 的群
            Assert.AreEqual(expectedResponse.data.AppAndroid.Photo.FirstOrDefault().AppOS, actualResponse.data.AppAndroid.Photo.FirstOrDefault().AppOS);
            //驗證 IOS 啟用狀態為 true
            Assert.AreEqual(expectedResponse.data.AppIos.Status, actualResponse.data.AppIos.Status);
        }
 private void BtnCancel_Click(Object Sender, EventArgs e)
 {
     //this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
     FResult = TResult.embrCancel;
     this.Close();
 }
Exemplo n.º 20
0
 public void SetResult(TResult res)
 {
     _result = res; _resultSet = true;
 }                                                                          // TODO: Protection from setting twice
 private void BtnNoToAll_Click(Object Sender, EventArgs e)
 {
     this.DialogResult = System.Windows.Forms.DialogResult.No;
     FResult = TResult.embrNoToAll;
     this.Close();
 }
 private void BtnOK_Click(Object Sender, EventArgs e)
 {
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
     FResult = TResult.embrOK;
     this.Close();
 }
        /// <summary>
        /// show form as dialog with given parameters
        /// </summary>
        /// <param name="AMessage">Message to be displayed to the user</param>
        /// <param name="ACaption">Caption of the dialog window</param>
        /// <param name="AChkOptionText">Text to be shown with check box (check box hidden if text empty)</param>
        /// <param name="AButtons">Button set to be displayed</param>
        /// <param name="ADefaultButton">The button with a default action</param>
        /// <param name="AIcon">Icon to be displayed</param>
        /// <param name="AOptionSelected">initial value for option check box</param>
        /// <returns></returns>
        public TFrmExtendedMessageBox.TResult ShowDialog(string AMessage, string ACaption, string AChkOptionText,
            TFrmExtendedMessageBox.TButtons AButtons,
            TFrmExtendedMessageBox.TDefaultButton ADefaultButton,
            TFrmExtendedMessageBox.TIcon AIcon,
            bool AOptionSelected)
        {
            string ResourceDirectory;
            string IconFileName;
            ToolTip ButtonTooltip = new ToolTip();

            // initialize return values
            FResult = TResult.embrUndefined;
            FOptionSelected = AOptionSelected;

            txtMessage.Text = AMessage;
            txtMessage.BorderStyle = BorderStyle.FixedSingle;
            txtMessage.HideSelection = true;
            txtMessage.SelectionStart = 0;
            txtMessage.SelectionLength = 0;
            txtMessage.Font = new System.Drawing.Font(txtMessage.Font, FontStyle.Regular);

            pnlLeftButtons.MinimumSize = new Size(btnHelp.Width + btnCopy.Width + 10, pnlLeftButtons.Height);

            ButtonTooltip.SetToolTip(btnHelp, "Help");
            ButtonTooltip.SetToolTip(btnCopy, "Copy to Clipboard");

            this.Text = ACaption;
            chkOption.Text = AChkOptionText;

            if (AChkOptionText.Length == 0)
            {
                chkOption.Visible = false;
            }

            chkOption.Checked = AOptionSelected;

            this.MinimumSize = new System.Drawing.Size(pnlLeftButtons.Width + pnlRightButtons.Width, 250);

            btnYes.Visible = false;
            btnYesToAll.Visible = false;
            btnNo.Visible = false;
            btnNoToAll.Visible = false;
            btnOK.Visible = false;
            btnCancel.Visible = false;

            FDefaultButton = ADefaultButton;

            switch (AButtons)
            {
                case TButtons.embbYesYesToAllNoCancel:
                    btnYes.Visible = true;
                    btnYesToAll.Visible = true;
                    btnNo.Visible = true;
                    btnCancel.Visible = true;
                    break;

                case TButtons.embbYesYesToAllNoNoToAllCancel:
                    btnYes.Visible = true;
                    btnYesToAll.Visible = true;
                    btnNo.Visible = true;
                    btnNoToAll.Visible = true;
                    btnCancel.Visible = true;
                    break;

                case TButtons.embbYesYesToAllNoNoToAll:
                    btnYes.Visible = true;
                    btnYesToAll.Visible = true;
                    btnNo.Visible = true;
                    btnNoToAll.Visible = true;
                    break;

                case TButtons.embbYesNo:
                    btnYes.Visible = true;
                    btnNo.Visible = true;
                    break;

                case TButtons.embbYesNoCancel:
                    btnYes.Visible = true;
                    btnNo.Visible = true;
                    btnCancel.Visible = true;
                    break;

                case TButtons.embbOK:
                    btnOK.Visible = true;
                    break;

                case TButtons.embbOKCancel:
                    btnOK.Visible = true;
                    btnCancel.Visible = true;
                    break;

                default:
                    break;
            }

            // dispose of items in case they were used already earlier
            if (FBitmap != null)
            {
                FBitmap.Dispose();
            }

            // find the right icon name
            switch (AIcon)
            {
                case TIcon.embiQuestion:
                    IconFileName = "Help.ico";
                    break;

                case TIcon.embiInformation:
                    IconFileName = "PetraInformation.ico";
                    break;

                case TIcon.embiWarning:
                    IconFileName = "Warning.ico";
                    break;

                case TIcon.embiError:
                    IconFileName = "Error.ico";
                    break;

                default:
                    IconFileName = "";
                    break;
            }

            if (FIconControl == null)
            {
                FIconControl = new PictureBox();

                // Stretches the image to fit the pictureBox.
                FIconControl.SizeMode = PictureBoxSizeMode.StretchImage;
                FIconControl.ClientSize = new Size(30, 30);
                pnlIcon.Padding = new Padding(3, 3, 3, 3);
            }

            // load and set the image
            ResourceDirectory = TAppSettingsManager.GetValue("Resource.Dir");

            if ((AIcon != TIcon.embiNone)
                && System.IO.File.Exists(ResourceDirectory + System.IO.Path.DirectorySeparatorChar + IconFileName))
            {
                pnlIcon.Visible = true;
                FBitmap = new System.Drawing.Bitmap(ResourceDirectory + System.IO.Path.DirectorySeparatorChar + IconFileName);
                FIconControl.Image = (Image)FBitmap;

                if (!pnlIcon.Controls.Contains(FIconControl))
                {
                    pnlIcon.Controls.Add(FIconControl);
                }
            }
            else
            {
                // remove icon panel if it already exists
                if (pnlIcon.Controls.Contains(FIconControl))
                {
                    pnlIcon.Controls.Remove(FIconControl);
                }

                pnlIcon.Visible = false;
            }

            // remove the controlbox as we do not need these options (min, max and close_
            this.ControlBox = false;

            // now show the actual dialog
            this.StartPosition = FormStartPosition.CenterScreen;
            this.ShowDialog();

            // FResult is initialized when buttons are pressed
            return FResult;
        }
 public Operation(TResult result) : this()
 {
     Completion.SetResult(result);
 }
            //---------------------------------------------------------------------------------------
            // Straightforward IEnumerator<T> methods.
            //

            internal override bool MoveNext([MaybeNullWhen(false), AllowNull] ref TResult currentElement, ref TKey currentKey)
            {
                Debug.Assert(_sharedIndices != null);

                // If the buffer has not been created, we will populate it lazily on demand.
                if (_buffer == null && _count > 0)
                {
                    // Create a buffer, but don't publish it yet (in case of exception).
                    List <Pair <TResult, TKey> > buffer = new List <Pair <TResult, TKey> >();

                    // Enter the search phase. In this phase, all partitions race to populate
                    // the shared indices with their first 'count' contiguous elements.
                    TResult current = default(TResult) !;
                    TKey    index   = default(TKey) !;
                    int     i       = 0; //counter to help with cancellation
                    while (buffer.Count < _count && _source.MoveNext(ref current !, ref index))
                    {
                        if ((i++ & CancellationState.POLL_INTERVAL) == 0)
                        {
                            _cancellationToken.ThrowIfCancellationRequested();
                        }
                        ;

                        // Add the current element to our buffer.
                        buffer.Add(new Pair <TResult, TKey>(current, index));

                        // Now we will try to insert our index into the shared indices list, quitting if
                        // our index is greater than all of the indices already inside it.
                        lock (_sharedIndices)
                        {
                            if (!_sharedIndices.Insert(index))
                            {
                                // We have read past the maximum index. We can move to the barrier now.
                                break;
                            }
                        }
                    }

                    // Before exiting the search phase, we will synchronize with others. This is a barrier.
                    _sharedBarrier.Signal();
                    _sharedBarrier.Wait(_cancellationToken);

                    // Publish the buffer and set the index to just before the 1st element.
                    _buffer      = buffer;
                    _bufferIndex = new Shared <int>(-1);
                }

                // Now either enter (or continue) the yielding phase. As soon as we reach this, we know the
                // index of the 'count'-th input element.
                if (_take)
                {
                    Debug.Assert(_buffer != null && _bufferIndex != null);
                    // In the case of a Take, we will yield each element from our buffer for which
                    // the element is lesser than the 'count'-th index found.
                    if (_count == 0 || _bufferIndex.Value >= _buffer.Count - 1)
                    {
                        return(false);
                    }

                    // Increment the index, and remember the values.
                    ++_bufferIndex.Value;
                    currentElement = _buffer[_bufferIndex.Value].First;
                    currentKey     = _buffer[_bufferIndex.Value].Second;

                    // Only yield the element if its index is less than or equal to the max index.
                    return(_sharedIndices.Count == 0 ||
                           _keyComparer.Compare(_buffer[_bufferIndex.Value].Second, _sharedIndices.MaxValue) <= 0);
                }
                else
                {
                    TKey minKey = default(TKey) !;

                    // If the count to skip was greater than 0, look at the buffer.
                    if (_count > 0)
                    {
                        // If there wasn't enough input to skip, return right away.
                        if (_sharedIndices.Count < _count)
                        {
                            return(false);
                        }

                        minKey = _sharedIndices.MaxValue;

                        Debug.Assert(_buffer != null && _bufferIndex != null);
                        // In the case of a skip, we must skip over elements whose index is lesser than the
                        // 'count'-th index found. Once we've exhausted the buffer, we must go back and continue
                        // enumerating the data source until it is empty.
                        if (_bufferIndex.Value < _buffer.Count - 1)
                        {
                            for (_bufferIndex.Value++; _bufferIndex.Value < _buffer.Count; _bufferIndex.Value++)
                            {
                                // If the current buffered element's index is greater than the 'count'-th index,
                                // we will yield it as a result.
                                if (_keyComparer.Compare(_buffer[_bufferIndex.Value].Second, minKey) > 0)
                                {
                                    currentElement = _buffer[_bufferIndex.Value].First;
                                    currentKey     = _buffer[_bufferIndex.Value].Second;
                                    return(true);
                                }
                            }
                        }
                    }

                    // Lastly, so long as our input still has elements, they will be yieldable.
                    if (_source.MoveNext(ref currentElement !, ref currentKey))
                    {
                        Debug.Assert(_count <= 0 || _keyComparer.Compare(currentKey, minKey) > 0,
                                     "expected remaining element indices to be greater than smallest");
                        return(true);
                    }
                }

                return(false);
            }
Exemplo n.º 26
0
 internal SucceededState(TResult result)
 {
     _result = result;
 }
Exemplo n.º 27
0
        /// <summary>
        /// 新增時需檢查置頂資料
        /// </summary>
        /// <param name="appNameCreate"></param>
        /// <returns></returns>
        public TResult <ResponseAppNameCreate> InsertAppName(AppNameCreate appNameCreate)
        {
            List <WisAppUserList> wisAppUserList = new List <WisAppUserList>();

            bool isExisted = _appListService.AppNameIsExisted(appNameCreate.AppName);

            if (appNameCreate.Category == "None")
            {
                return(TResult <ResponseAppNameCreate> .Fail(new ResponseAppNameCreate { IsSuccessful = false, AppID = "" }, FaultInfoRcConstants.ERR_CODE_FAIL, "請選擇類別"));
            }

            if (isExisted)
            {
                return(TResult <ResponseAppNameCreate> .Fail(new ResponseAppNameCreate { IsSuccessful = false, AppID = "" }, FaultInfoRcConstants.ERR_CODE_FAIL, "App 名稱已存在"));
            }

            //撈出置頂資料
            List <InSideOrOutSideApp> inSideOrOutSideApps = _appListService.GetIsTopAppList();

            #region  Check 置頂

            //如果要頂置 檢查頂置規則 企業APP 2筆 外部 App 2筆
            if (appNameCreate.IsTop)
            {
                //企業專用	true:企業APP , false:外部APP
                if (appNameCreate.CompanyApp)
                {
                    //內部 app
                    int inSideTop = inSideOrOutSideApps.Where(p => p.CompanyApp.Equals("Inside App")).Count();
                    if (inSideTop >= 2)
                    {
                        return(TResult <ResponseAppNameCreate> .Fail(new ResponseAppNameCreate { IsSuccessful = false, AppID = "" }, FaultInfoRcConstants.ERR_CODE_FAIL, "企業內部 App 置頂最多為2筆"));
                    }
                }
                else
                {
                    //外部 app
                    int outSideTop = inSideOrOutSideApps.Where(p => p.CompanyApp.Equals("Outside App")).Count();
                    if (outSideTop >= 2)
                    {
                        return(TResult <ResponseAppNameCreate> .Fail(new ResponseAppNameCreate { IsSuccessful = false, AppID = "" }, FaultInfoRcConstants.ERR_CODE_FAIL, "外部 App 置頂最多為2筆"));
                    }
                }
            }

            #endregion

            //DTO
            WisAppList wisApp = _mapper.Map <AppNameCreate, WisAppList>(appNameCreate);

            string   appID = Guid.NewGuid().ToString();
            DateTime date  = DateTime.Now;

            appNameCreate.AppID   = appID;
            wisApp.AppID          = appID;
            wisApp.LastUpdateUser = "******";
            wisApp.LastUpdateDT   = date;
            wisApp.CreateDT       = date;
            wisApp.Delflag        = false;
            //開放使用,無須授權	1:開放,0:有授權名單

            #region 授權群組 設定 AppOen  1:開放,0:有授權名單
            List <string> groupID = new List <string>();
            groupID = wisApp.AppUserGroup?.Split(',').ToList();

            List <WisDefineGroup> wisDefineGroups = _appListService.GetDefineGroup(groupID);

            foreach (var item in wisDefineGroups)
            {
                //新增群組
                if (!string.IsNullOrEmpty(item.GroupInclude))
                {
                    List <MdsHrEmpData> mdsHrEmpData = new List <MdsHrEmpData>();
                    List <string>       findGroup    = item.GroupInclude.Split(',').ToList();
                    if (item.SelectGroup == "1") // 找Site
                    {
                        mdsHrEmpData.AddRange(_appListService.GetHrEmpByLocation(findGroup));
                    }
                    else // 找 DeptID
                    {
                        mdsHrEmpData.AddRange(_appListService.GetHrEmpByDept(findGroup));
                    }

                    List <WisAppUserList> findAppUser = mdsHrEmpData.Select(p => new WisAppUserList {
                        AppID = appNameCreate.AppID, UserID = p.Uid
                    }).ToList();

                    wisAppUserList.AddRange(findAppUser);
                }

                //新增 自定義的user
                if (!string.IsNullOrEmpty(item.AccountInclude))
                {
                    List <MdsAdUserData> mdsAdUserDatas = new List <MdsAdUserData>();
                    List <MdsHrEmpData>  mdsHrEmpData   = new List <MdsHrEmpData>();
                    List <string>        findUId        = item.AccountInclude.Split(',').ToList();
                    if (item.SelectAccount == "1") // 找 AD Data
                    {
                        mdsAdUserDatas = _appListService.GetMdsAdUser(findUId);
                    }
                    else // 找 HR Data
                    {
                        mdsHrEmpData = _appListService.GetHrEmpByUId(findUId);
                    }

                    List <WisAppUserList> findAppUser = mdsAdUserDatas.Select(p => new WisAppUserList {
                        AppID = appNameCreate.AppID, UserID = p.Uid
                    }).ToList();
                    List <WisAppUserList> findAppUserByHr = mdsHrEmpData.Select(p => new WisAppUserList {
                        AppID = appNameCreate.AppID, UserID = p.Uid
                    }).ToList();

                    wisAppUserList.AddRange(findAppUser);
                    wisAppUserList.AddRange(findAppUserByHr);
                }
            }

            #endregion

            bool inserted = _appListService.InsertAppName(wisApp, wisAppUserList);

            if (inserted)
            {
                return(TResult <ResponseAppNameCreate> .OK(new ResponseAppNameCreate { IsSuccessful = true, AppID = appID }, appNameCreate.AppName));
            }
            else
            {
                return(TResult <ResponseAppNameCreate> .Fail(new ResponseAppNameCreate { IsSuccessful = false, AppID = "" }, FaultInfoRcConstants.ERR_CODE_FAIL, "Insert App name fail!"));
            }
        }
Exemplo n.º 28
0
     this IEnumerable <TSource> sourceData,
     Func <TSource, DateTimeOffset> timeSampler, Func <TSource, TResult> sampler,
     TimeSpan interval, DateTimeOffset endTime, TResult defaultValue, DateTimeOffset?startFrom = default)
 {
Exemplo n.º 29
0
        /// <summary>
        /// 更新 Wis App name
        /// </summary>
        /// <param name="appNameCreate"></param>
        /// <returns></returns>
        public TResult <bool> ModifyAppName(AppNameCreate appNameCreate)
        {
            List <WisAppUserList> wisAppUserList = new List <WisAppUserList>();

            //撈出置頂總合資料
            List <InSideOrOutSideApp> inSideOrOutSideApps = _appListService.GetIsTopAppList();

            #region Check 置頂

            //如果要頂置 需檢查頂置規則 企業APP 2筆 外部 App 2筆
            if (appNameCreate.IsTop)
            {
                //企業專用	true:企業APP , false:外部APP
                if (appNameCreate.CompanyApp)
                {
                    //內部 app得要排除 自己的部分
                    int inSideTop = inSideOrOutSideApps.Where(p => p.CompanyApp.Equals("Inside App") && p.AppID != appNameCreate.AppID).Count();

                    if (inSideTop >= 2)
                    {
                        return(TResult <bool> .Fail(false, FaultInfoRcConstants.ERR_CODE_FAIL, "企業內部 App 置頂最多為2筆"));
                    }
                }
                else
                {
                    //外部 app 得要排除 自己的部分
                    int outSideTop = inSideOrOutSideApps.Where(p => p.CompanyApp.Equals("Outside App") && p.AppID != appNameCreate.AppID).Count();

                    if (outSideTop >= 2)
                    {
                        return(TResult <bool> .Fail(false, FaultInfoRcConstants.ERR_CODE_FAIL, "外部 App 置頂最多為2筆"));
                    }
                }
            }

            #endregion

            //DTO
            WisAppList wisApp = _mapper.Map <AppNameCreate, WisAppList>(appNameCreate);
            DateTime   date   = DateTime.Now;
            wisApp.LastUpdateUser = "******";
            wisApp.LastUpdateDT   = date;

            #region 授權群組 設定 AppOen  1:開放,0:有授權名單

            List <string> groupID = wisApp.AppUserGroup?.Split(',').ToList();

            List <WisDefineGroup> wisDefineGroups = _appListService.GetDefineGroup(groupID);

            foreach (var item in wisDefineGroups)
            {
                //新增群組
                if (!string.IsNullOrEmpty(item.GroupInclude))
                {
                    List <MdsHrEmpData> mdsHrEmpData = new List <MdsHrEmpData>();
                    List <string>       findGroup    = item.GroupInclude.Split(',').ToList();
                    if (item.SelectGroup == "1") // 找Site
                    {
                        mdsHrEmpData = _appListService.GetHrEmpByLocation(findGroup);
                    }
                    else // 找 DeptID
                    {
                        mdsHrEmpData = _appListService.GetHrEmpByDept(findGroup);
                    }

                    List <WisAppUserList> findAppUser = mdsHrEmpData.Select(p => new WisAppUserList {
                        AppID = appNameCreate.AppID, UserID = p.Uid
                    }).ToList();

                    wisAppUserList.AddRange(findAppUser);
                }

                //新增 自定義的user
                if (!string.IsNullOrEmpty(item.AccountInclude))
                {
                    List <MdsAdUserData> mdsAdUserDatas = new List <MdsAdUserData>();
                    List <MdsHrEmpData>  mdsHrEmpData   = new List <MdsHrEmpData>();
                    List <string>        findUId        = item.AccountInclude.Split(',').ToList();
                    if (item.SelectAccount == "1") // 找 AD Data
                    {
                        mdsAdUserDatas = _appListService.GetMdsAdUser(findUId);
                    }
                    else // 找 HR Data
                    {
                        mdsHrEmpData = _appListService.GetHrEmpByUId(findUId);
                    }

                    List <WisAppUserList> findAppUser = mdsAdUserDatas.Select(p => new WisAppUserList {
                        AppID = appNameCreate.AppID, UserID = p.Uid
                    }).ToList();
                    List <WisAppUserList> findAppUserByHr = mdsHrEmpData.Select(p => new WisAppUserList {
                        AppID = appNameCreate.AppID, UserID = p.Uid
                    }).ToList();

                    wisAppUserList.AddRange(findAppUser);
                    wisAppUserList.AddRange(findAppUserByHr);
                }
            }

            #endregion

            bool isModified = _appListService.ModifyAppName(wisApp, wisAppUserList);

            if (isModified)
            {
                return(TResult <bool> .OK(true, appNameCreate.AppName));
            }
            else
            {
                return(TResult <bool> .Fail(false, FaultInfoRcConstants.ERR_CODE_FAIL, "Modify App name fail!"));
            }
        }
Exemplo n.º 30
0
        public ActionResult SelectShop()
        {
            ViewBag.count = BuildFactory.AppylyStroeFactory().QueryShop().Count;

            var str = string.Empty;
            var city = string.Empty;
            if (Request["key"] != null)
            {
                str = Request["key"];
            }
            if (Request["c"] != null)
            {
                city = Request["c"];
            }
            var result = new TResult<List<Entity.SpeechInfoEntity>>();
            SpeechInfoBLL bll = new SpeechInfoBLL();
            ViewBag.Citys = citys;
            result = bll.GetAllSpeechInfoList(str, city, null);

            ;

            return View(result);
        }
Exemplo n.º 31
0
 public MatchItem(TSource source, TResult result, bool matched)
 {
     this.Source  = source;
     this.Result  = result;
     this.Matched = matched;
 }
Exemplo n.º 32
0
        public void SendUzExResult(TResult result)
        {
            var xml = IOHelper.XmlEncode(result);

            _adapter.Send(xml);
        }
Exemplo n.º 33
0
		/// <summary>
        /// 获取全部对象
        /// </summary>
        /// <param name="tran">事务</param>
		/// <returns>对象实体</returns>
		public TResult<List< UsersEntity>> GetAllUsersList(SqlTransaction tran)
		{
            TResult<List< UsersEntity>> result = new TResult<List< UsersEntity>>();
            
            List< UsersEntity> list =  UsersDAL.GetAllUsersList(tran);
            if (list == null)
            {
                result.IsSuccess = false;
                result.Message = "不存在";

                return result;
            }

            result.IsSuccess = true;
            result.TData = list;
            result.Message = "获取成功";
            return result;
		}
Exemplo n.º 34
0
            //---------------------------------------------------------------------------------------
            // Straightforward IEnumerator<T> methods.
            //

            internal override bool MoveNext([MaybeNullWhen(false), AllowNull] ref TResult currentElement, [AllowNull] ref TKey currentKey)
            {
                // If the buffer has not been created, we will generate it lazily on demand.
                if (_buffer == null)
                {
                    // Create a buffer, but don't publish it yet (in case of exception).
                    List <Pair <TResult, TKey> > buffer = new List <Pair <TResult, TKey> >();

                    // Enter the search phase.  In this phase, we scan the input until one of three
                    // things happens:  (1) all input has been exhausted, (2) the predicate yields
                    // false for one of our elements, or (3) we move past the current lowest index
                    // found by other partitions for a false element.  As we go, we have to remember
                    // the elements by placing them into the buffer.

                    try
                    {
                        TResult current = default(TResult) !;
                        TKey    key     = default(TKey) !;
                        int     i       = 0; //counter to help with cancellation
                        while (_source.MoveNext(ref current !, ref key))
                        {
                            if ((i++ & CancellationState.POLL_INTERVAL) == 0)
                            {
                                _cancellationToken.ThrowIfCancellationRequested();
                            }
                            ;

                            // Add the current element to our buffer.
                            buffer.Add(new Pair <TResult, TKey>(current, key));

                            // See if another partition has found a false value before this element. If so,
                            // we should stop scanning the input now and reach the barrier ASAP.
                            if (_updatesSeen != _operatorState._updatesDone)
                            {
                                lock (_operatorState)
                                {
                                    _currentLowKey = _operatorState._currentLowKey;
                                    _updatesSeen   = _operatorState._updatesDone;
                                }
                            }

                            if (_updatesSeen > 0 && _keyComparer.Compare(key, _currentLowKey) > 0)
                            {
                                break;
                            }

                            // Evaluate the predicate, either indexed or not based on info passed to the ctor.
                            bool predicateResult;
                            if (_predicate != null)
                            {
                                predicateResult = _predicate(current);
                            }
                            else
                            {
                                Debug.Assert(_indexedPredicate != null);
                                predicateResult = _indexedPredicate(current, key);
                            }

                            if (!predicateResult)
                            {
                                // Signal that we've found a false element, racing with other partitions to
                                // set the shared index value.
                                lock (_operatorState)
                                {
                                    if (_operatorState._updatesDone == 0 || _keyComparer.Compare(_operatorState._currentLowKey, key) > 0)
                                    {
                                        _currentLowKey = _operatorState._currentLowKey = key;
                                        _updatesSeen   = ++_operatorState._updatesDone;
                                    }
                                }

                                break;
                            }
                        }
                    }
                    finally
                    {
                        // No matter whether we exit due to an exception or normal completion, we must ensure
                        // that we signal other partitions that we have completed.  Otherwise, we can cause deadlocks.
                        _sharedBarrier.Signal();
                    }

                    // Before exiting the search phase, we will synchronize with others. This is a barrier.
                    _sharedBarrier.Wait(_cancellationToken);

                    // Publish the buffer and set the index to just before the 1st element.
                    _buffer      = buffer;
                    _bufferIndex = new Shared <int>(-1);
                }

                Debug.Assert(_bufferIndex != null);
                // Now either enter (or continue) the yielding phase. As soon as we reach this, we know the
                // current shared "low false" value is the absolute lowest with a false.
                if (_take)
                {
                    // In the case of a take-while, we will yield each element from our buffer for which
                    // the element is lesser than the lowest false index found.
                    if (_bufferIndex.Value >= _buffer.Count - 1)
                    {
                        return(false);
                    }

                    // Increment the index, and remember the values.
                    ++_bufferIndex.Value;
                    currentElement = _buffer[_bufferIndex.Value].First;
                    currentKey     = _buffer[_bufferIndex.Value].Second;

                    return(_operatorState._updatesDone == 0 || _keyComparer.Compare(_operatorState._currentLowKey, currentKey) > 0);
                }
                else
                {
                    // If no false was found, the output is empty.
                    if (_operatorState._updatesDone == 0)
                    {
                        return(false);
                    }

                    // In the case of a skip-while, we must skip over elements whose index is lesser than the
                    // lowest index found. Once we've exhausted the buffer, we must go back and continue
                    // enumerating the data source until it is empty.
                    if (_bufferIndex.Value < _buffer.Count - 1)
                    {
                        for (_bufferIndex.Value++; _bufferIndex.Value < _buffer.Count; _bufferIndex.Value++)
                        {
                            // If the current buffered element's index is greater than or equal to the smallest
                            // false index found, we will yield it as a result.
                            if (_keyComparer.Compare(_buffer[_bufferIndex.Value].Second, _operatorState._currentLowKey) >= 0)
                            {
                                currentElement = _buffer[_bufferIndex.Value].First;
                                currentKey     = _buffer[_bufferIndex.Value].Second;
                                return(true);
                            }
                        }
                    }

                    // Lastly, so long as our input still has elements, they will be yieldable.
                    if (_source.MoveNext(ref currentElement !, ref currentKey))
                    {
                        Debug.Assert(_keyComparer.Compare(currentKey, _operatorState._currentLowKey) > 0,
                                     "expected remaining element indices to be greater than smallest");
                        return(true);
                    }
                }

                return(false);
            }
Exemplo n.º 35
0
        public ActionResult Index()
        {
            //IPScaner objScan = new IPScaner();
            //string ip = Request.UserHostAddress.ToString();
            //objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat");
            //objScan.IP = "58.19.17.114";
            ////"113.200.29.90";
            //string addre = "湖北省武汉市";
            //int IndexofA = addre.IndexOf("省") + 1;
            //var ct = addre.Substring(0,IndexofA);

            //Response.Write("58.19.17.114====" + addre + "========" + ct);

            var str = string.Empty;
            var city = string.Empty;
            if (Request["key"] != null)
            {
                str = Request["key"];
            }
            if (Request["c"] != null)
            {
                city = Request["c"];
            }
            var result = new TResult<List<Entity.SpeechInfoEntity>>();
            SpeechInfoBLL bll = new SpeechInfoBLL();
            ViewBag.Citys = citys;
            result = bll.GetAllSpeechInfoList(str, city, null);

              ;

            return View(result);
        }
Exemplo n.º 36
0
 public SourceResultPair(TSource source, TResult result)
 {
     Source = source;
     Result = result;
 }
Exemplo n.º 37
0
        /// <summary>
        /// ...
        /// </summary>
        public void TestDetailReport(String ATestPath, String ASettingsPath)
        {
            String detailReportCSV;
            String action;
            String query;
            String paramName;
            String paramValue;
            int    SelectedRow;
            int    columnCounter;

            detailReportCSV = FCalculator.GetParameters().Get("param_detail_report_0").ToString();
            TLogging.Log("detail report: " + StringHelper.GetNextCSV(ref detailReportCSV, ","));
            action = StringHelper.GetNextCSV(ref detailReportCSV, ",");

            if (action == "PartnerEditScreen")
            {
                /* get the partner key from the parameter */
                SelectedRow = 0;

                ArrayList rows = FCalculator.GetResults().GetResults();

                if (rows.Count > SelectedRow)
                {
                    TResult row = (TResult)rows[SelectedRow];
                    Console.WriteLine("detailReportCSV " + detailReportCSV.ToString());
                    Console.WriteLine(rows.Count.ToString());

                    if (row.column.Length > 0)
                    {
                        TLogging.Log("Open Partner Edit Screen for partner " + row.column[Convert.ToInt32(detailReportCSV)].ToString());
                    }
                }
            }
            else if (action.IndexOf(".xml") != -1)
            {
                query = StringHelper.GetNextCSV(ref detailReportCSV, ",");
                FCalculator.GetParameters().Add("param_whereSQL", query);

                /* get the parameter names and values */
                while (detailReportCSV.Length > 0)
                {
                    paramName  = StringHelper.GetNextCSV(ref detailReportCSV, ",");
                    paramValue = StringHelper.GetNextCSV(ref detailReportCSV, ",");
                    FCalculator.GetParameters().Add(paramName, paramValue);
                }

                /* add the values of the selected column (in this example the first one) */
                SelectedRow = 1;

                for (columnCounter = 0; columnCounter <= FCalculator.GetParameters().Get("MaxDisplayColumns").ToInt32() - 1; columnCounter += 1)
                {
                    FCalculator.GetParameters().Add("param_" +
                                                    FCalculator.GetParameters().Get("param_calculation",
                                                                                    columnCounter).ToString(), ((TResult)FCalculator.GetResults().GetResults()[SelectedRow]).column[columnCounter]);
                }

                /* action is a link to a settings file; it contains e.g. xmlfiles, currentReport, and column settings */
                /* TParameterList.Load adds the new parameters to the existing parameters */
                FCalculator.GetParameters().Load(ASettingsPath + '/' + action);

                if (FCalculator.GenerateResultRemoteClient())
                {
                    FCalculator.GetParameters().Save(ATestPath + "LogParametersAfterCalcDetail.log", true);
                    FCalculator.GetResults().WriteCSV(FCalculator.GetParameters(), ATestPath + "LogResultsDetail.log", "FIND_BEST_SEPARATOR", true);

                    /* test if there is a detail report */
                    if (FCalculator.GetParameters().Exists("param_detail_report_0") == true)
                    {
                        TestDetailReport(ATestPath, ASettingsPath);
                    }
                }
            }
        }
Exemplo n.º 38
0
 internal abstract void SetSucceeded(out State state, out Action postscript, TResult result);
Exemplo n.º 39
0
        /// <summary>
        /// Send this SodaRequest's webRequest and interpret the response.
        /// </summary>
        /// <typeparam name="TResult">The target type during response deserialization.</typeparam>
        /// <exception cref="System.InvalidOperationException">Thrown if response deserialization into the requested type fails.</exception>
        internal TResult ParseResponse <TResult>() where TResult : class
        {
            TResult   result    = default(TResult);
            Exception inner     = null;
            bool      exception = false;

            using (var responseStream = webRequest.GetResponse().GetResponseStream())
            {
                string response = new StreamReader(responseStream).ReadToEnd();

                //attempt to deserialize based on the requested format
                switch (dataFormat)
                {
                case SodaDataFormat.JSON:
                    try
                    {
                        result = Newtonsoft.Json.JsonConvert.DeserializeObject <TResult>(response);
                    }
                    catch (Newtonsoft.Json.JsonException jex)
                    {
                        inner     = jex;
                        exception = true;
                    }
                    break;

                case SodaDataFormat.CSV:
                    //TODO: should we consider this an error (i.e. InvalidOperationException) if this cast returns null?
                    result = response as TResult;
                    break;

                case SodaDataFormat.XML:
                    //see if the caller just wanted the XML string
                    var ttype = typeof(TResult);
                    if (ttype == typeof(string))
                    {
                        result = response as TResult;
                    }
                    else
                    {
                        //try to deserialize the XML response
                        try
                        {
                            var reader     = XmlReader.Create(new StringReader(response));
                            var serializer = new XmlSerializer(ttype);
                            result = serializer.Deserialize(reader) as TResult;
                        }
                        catch (Exception ex)
                        {
                            inner     = ex;
                            exception = true;
                        }
                    }
                    break;
                }
            }

            if (exception)
            {
                //we want to float this error up to clients
                throw new InvalidOperationException(String.Format("Couldn't deserialize the ({0}) response into an instance of type {1}.", dataFormat, typeof(TResult)), inner);
            }

            return(result);
        }
Exemplo n.º 40
0
		/// <summary>
        /// 根据编号获取实体
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="tran">事务</param>
		/// <returns>对象实体</returns>
		public TResult<SpeechInfoEntity> GetSpeechInfoEntityByID(Guid id, SqlTransaction tran)
		{
            TResult< SpeechInfoEntity> result = new TResult< SpeechInfoEntity>();
            
             SpeechInfoEntity entity =  SpeechInfoDAL.GetSpeechInfoEntityByID(id, tran);
            if (entity == null)
            {
                result.IsSuccess = false;
                result.Message = "不存在";

                return result;
            }

            result.IsSuccess = true;
            result.TData = entity;
            result.Message = "获取成功";
            return result;
		}
Exemplo n.º 41
0
 internal sealed override void SetSucceeded(out State state, out Action postscript, TResult result)
 {
     state      = this;
     postscript = () => throw new InvalidOperationException();
 }
Exemplo n.º 42
0
 internal override void SetSucceeded(out State state, out Action postscript, TResult result)
 {
     state      = new SucceededState(result);
     postscript = Postscript;
 }
Exemplo n.º 43
0
 internal abstract void TrySetSucceeded(out State state, out Func <bool> postscript, TResult result);
        /// <summary>
        /// String statements work differently.  Basically it's just a search and replace for
        /// @identifier nodes, with the rest treated as a string literal.
        /// </summary>
        /// <returns>The full string after parsing</returns>
        public override TResult ParseStatement <TResult>()
        {
            verbose &= LogEntryDebug <TResult>("ParseStatement");
            try
            {
                expression = expression.Trim();
                string savedExpression = expression;
                Token  token           = null;
                try
                {
                    token = ParseToken();
                }
                catch { }
                finally
                {
                    expression = savedExpression;
                }

                string value = "";

                bool quoted = token != null && token.tokenType == TokenType.QUOTE;
                if (quoted)
                {
                    expression = expression.Substring(1);
                }
                else if (token != null && token.tokenType == TokenType.SPECIAL_IDENTIFIER)
                {
                    TResult result = base.ParseStatement <TResult>();
                    if (parentParser != null)
                    {
                        return(result);
                    }

                    value = (string)(object)result ?? "";
                }
                else
                {
                    // Check for an immediate function call
                    Match m = Regex.Match(expression, @"^\w[\w\d]*\(");
                    if (m.Success)
                    {
                        return(base.ParseStatement <TResult>());
                    }
                }

                while (expression.Length > 0)
                {
                    // Look for special identifiers
                    int specialIdentifierIndex = expression.IndexOf("@");

                    // Look for data store identifiers
                    Match m = Regex.Match(expression, @"\$[A-Za-z]");
                    int   dataStoreIdentifierIndex = m.Success ? m.Index : -1;

                    // Look for function calls
                    m = Regex.Match(expression, @"(\A|\s)\w[\w\d]*\(");
                    int functionIndex = m == Match.Empty ? -1 : m.Index;

                    // Look for an end quote
                    int quoteIndex = quoted ? expression.IndexOf('"') : -1;
                    if (quoteIndex > 0)
                    {
                        if (expression.Substring(quoteIndex - 1, 1) == "\\")
                        {
                            quoteIndex = -1;
                        }
                    }

                    if (m.Success && (specialIdentifierIndex == -1 || functionIndex < specialIdentifierIndex) &&
                        (dataStoreIdentifierIndex == -1 || functionIndex < dataStoreIdentifierIndex) && (quoteIndex == -1 || functionIndex < quoteIndex))
                    {
                        specialIdentifierIndex   = -1;
                        dataStoreIdentifierIndex = -1;
                        quoteIndex = -1;
                    }
                    else if (quoteIndex != -1 && (specialIdentifierIndex == -1 || quoteIndex < specialIdentifierIndex) &&
                             (dataStoreIdentifierIndex == -1 || quoteIndex < dataStoreIdentifierIndex))
                    {
                        specialIdentifierIndex   = -1;
                        dataStoreIdentifierIndex = -1;
                        functionIndex            = -1;
                    }
                    else if (dataStoreIdentifierIndex != -1 && (specialIdentifierIndex == -1 || dataStoreIdentifierIndex < specialIdentifierIndex))
                    {
                        specialIdentifierIndex = -1;
                        functionIndex          = -1;
                        quoteIndex             = -1;
                    }
                    else
                    {
                        dataStoreIdentifierIndex = -1;
                        functionIndex            = -1;
                        quoteIndex = -1;
                    }

                    if (functionIndex >= 0)
                    {
                        if (functionIndex > 0 || expression[0] == ' ')
                        {
                            value += expression.Substring(0, functionIndex + 1);
                        }
                        expression = expression.Substring(functionIndex);
                        Token t = ParseToken();

                        bool canParse = false;
                        try
                        {
                            Function selectedMethod = null;
                            GetCalledFunction(t.sval, ref selectedMethod, true);
                            canParse = true;
                        }
                        catch { }

                        if (canParse)
                        {
                            value += ParseMethod <string>(t, null, true);
                        }
                        else
                        {
                            value += t.sval;
                        }
                    }
                    else if (specialIdentifierIndex >= 0)
                    {
                        value     += expression.Substring(0, specialIdentifierIndex);
                        expression = expression.Substring(specialIdentifierIndex);
                        value     += ParseSpecialIdentifier(ParseSpecialIdentifier());
                    }
                    else if (dataStoreIdentifierIndex >= 0)
                    {
                        value     += expression.Substring(0, dataStoreIdentifierIndex);
                        expression = expression.Substring(dataStoreIdentifierIndex);

                        // Workaround for limitation/bug in how the expression factory works.  Will probably need to revisit
                        if (currentDataNode.Factory is Behaviour.ExpressionFactory)
                        {
                            value     += expression.Substring(0, 1);
                            expression = expression.Substring(1);
                        }
                        else
                        {
                            value += ParseDataStoreIdentifier(ParseDataStoreIdentifier());
                        }
                    }
                    else if (quoteIndex >= 0)
                    {
                        value     += expression.Substring(0, quoteIndex);
                        expression = expression.Substring(quoteIndex + 1);
                        break;
                    }
                    else
                    {
                        value     += expression;
                        expression = "";
                    }
                }

                value = value.Replace("&br;", "\n");
                value = value.Replace("\\n", "\n");

                if (expression.Length > 0 && parentParser == null)
                {
                    value = ParseStatement <string>(value);
                }

                verbose &= LogExitDebug <TResult>("ParseStatement", value);
                return((TResult)(object)value);
            }
            catch
            {
                verbose &= LogException <TResult>("ParseStatement");
                throw;
            }
        }
Exemplo n.º 45
0
 public static ExecutionInfo CreateResult(TResult result) =>
 new ExecutionInfo(ExecutionDemarcation.Result, result);
Exemplo n.º 46
0
 public IdResultPair(TResultId id, TResult item)
 {
     Id   = id;
     Item = item;
 }
Exemplo n.º 47
0
 internal override void TrySetSucceeded(out State state, out Func <bool> postscript, TResult result)
 {
     state      = new SucceededState(result);
     postscript = TryPostscript;
 }
Exemplo n.º 48
0
 /// <summary>
 /// 中间1.	发言
 /// </summary>
 /// <returns></returns>
 public ActionResult GetSpeachList()
 {
     var result = new TResult<List<Entity.SpeechInfoEntity>>();
     SpeechInfoBLL bll = new SpeechInfoBLL();
     //result = bll.GetAllSpeechInfoList(null);
     return View(result);
 }
Exemplo n.º 49
0
        /// <summary>
        /// 更新 Wis APP os
        /// </summary>
        /// <param name="appOsInfo"></param>
        /// <returns></returns>
        public TResult <bool> InsertOrModifyAppOs(AppOsInfo appOsInfo)
        {
            //短解 應該前端要給預設值 DownloadUrlList.Count = 0 這樣的設定 要不然會throw exception
            if (appOsInfo.DownloadUrlList == null)
            {
                appOsInfo.DownloadUrlList = new List <DownloadUrlList>();
            }

            //CompanyApp  = false 欄位版本資訊為空值 補上預設值 原因是外部App 不需要輸入版本號 但是db 欄位為必填
            if (string.IsNullOrEmpty(appOsInfo.Version))
            {
                appOsInfo.Version = "";
            }

            DateTime date = DateTime.Now;

            WisAppOs           wisAppOs    = _mapper.Map <AppOsInfo, WisAppOs>(appOsInfo);
            List <WisAppPhoto> wisAppPhoto = _mapper.Map <List <AppPhotoContent>, List <WisAppPhoto> >(appOsInfo.Photo);

            //視為存在條件  AppID & OsType & Version
            WisAppOs wisAppOsFromDb = _appListService.AppOsIsExisted(appOsInfo.AppID, appOsInfo.OSType, appOsInfo.Version);

            //沒有代表是新增
            if (wisAppOsFromDb == null)
            {
                List <WisAppOsOther> insertWisAppOsOthers = new List <WisAppOsOther>();
                wisAppOs.DelFlag        = false;
                wisAppOs.LastUpdateUser = "******";
                wisAppOs.CreateDT       = date;
                wisAppOs.LastUpdateDT   = date;

                //多載點功能啟用 才新增
                if (appOsInfo.MultipleDownload)
                {
                    //多載點處理
                    foreach (DownloadUrlList downloadUrl in appOsInfo.DownloadUrlList)
                    {
                        insertWisAppOsOthers.Add(new WisAppOsOther
                        {
                            AppID          = wisAppOs.AppID,
                            AppOsID        = 0,//等transaction當中insert
                            Site           = downloadUrl.Site,
                            OSType         = wisAppOs.OSType,
                            Version        = wisAppOs.Version,
                            FileName       = appOsInfo.FileName, //IOS 為 ipa路徑 Android 為原始 apk檔案名稱
                            FilePath       = downloadUrl.Url,    //IOS 為plist路徑  Android 為apk路徑
                            LastUpdateUser = "******",
                            LastUpdateDT   = date,
                            CreateDT       = date
                        });
                    }
                }

                bool isInserted = _appListService.DisableAppOsStatusAndInsertAppOsAndPhotoAndOsOther(wisAppOs, wisAppPhoto, insertWisAppOsOthers);

                if (isInserted)
                {
                    //取新增後的 appOsID
                    WisAppOs insertObject = _appListService.GetAppOs(appOsInfo.AppID).FirstOrDefault(p => p.OSType == appOsInfo.OSType && p.Status == AppStatus.EnableBool);
                    return(TResult <bool> .OK(true, insertObject.AppOSID.ToString()));
                }
                else
                {
                    return(TResult <bool> .Fail(false, FaultInfoRcConstants.ERR_CODE_FAIL, "Insert App Os fail!"));
                }
            }
            else
            { //有在DB 找到 代表更新
                List <WisAppOsOther> insertWisAppOsOthers = new List <WisAppOsOther>();
                wisAppOs.DelFlag        = wisAppOsFromDb.DelFlag;
                wisAppOs.LastUpdateUser = wisAppOsFromDb.LastUpdateUser;
                wisAppOs.CreateDT       = wisAppOsFromDb.CreateDT;
                wisAppOs.LastUpdateDT   = date;

                //多載點功能啟用 才更新
                if (appOsInfo.MultipleDownload)
                {
                    //多載點 處理
                    foreach (DownloadUrlList downloadUrl in appOsInfo.DownloadUrlList)
                    {
                        insertWisAppOsOthers.Add(new WisAppOsOther
                        {
                            AppID          = wisAppOs.AppID,
                            AppOsID        = wisAppOs.AppOSID,//必定會有 AppOsID
                            Site           = downloadUrl.Site,
                            OSType         = wisAppOs.OSType,
                            Version        = wisAppOs.Version,
                            FileName       = appOsInfo.FileName, //IOS 為 ipa路徑 Android 為原始 apk檔案名稱
                            FilePath       = downloadUrl.Url,    //IOS 為plist路徑  Android 為apk路徑
                            LastUpdateUser = "******",
                            LastUpdateDT   = date,
                            CreateDT       = date
                        });
                    }
                }

                bool isUpdated = _appListService.DisableAppOsStatusAndModifyAppOsAndPhotoAndOsOther(wisAppOs, wisAppPhoto, insertWisAppOsOthers);

                if (isUpdated)//返回 更新
                {
                    return(TResult <bool> .OK(true, appOsInfo.AppOSID.ToString()));
                }
                else
                {
                    return(TResult <bool> .Fail(false, FaultInfoRcConstants.ERR_CODE_FAIL, "Update App Os fail!"));
                }
            }
        }
Exemplo n.º 50
0
 public ActionResult Index1(string Searchkey, string city)
 {
     var str = Searchkey;
     var result = new TResult<List<Entity.SpeechInfoEntity>>();
     SpeechInfoBLL bll = new SpeechInfoBLL();
     ViewBag.Citys = citys;
     ViewBag.Sel = city;
     ViewBag.Key = Searchkey;
     result = bll.GetAllSpeechInfoList(str, city, null);
     return View("Index",result);
 }
Exemplo n.º 51
0
        /// <summary>
        /// 頁簽畫面 ViewModel
        /// </summary>
        /// <param name="appID"></param>
        /// <param name="appOsID"></param>
        /// <param name="appOsType"></param>
        /// <returns></returns>
        public TResult <AppEditViewModel> GetCreateAndEditApp(string appID, string appOsID = "", string appOsType = "")
        {
            WisAppList           wisAppList     = _appListService.GetAppName(appID);
            List <WisAppOs>      wisAppOs       = _appListService.GetAppOs(appID);
            List <WisAppPhoto>   wisAppPhoto    = _uploadFileService.GetPhotos(appID);
            List <WisAppOsOther> wisAppOsOthers = _uploadFileService.GetWisAppOsOther(appID, appOsID);

            AppOsInfo         editAppIos        = null;
            AppOsInfo         editAppAndroid    = null;
            List <AppOsOther> iosAppOsOther     = new List <AppOsOther>();
            List <AppOsOther> androidAppOsOther = new List <AppOsOther>();

            //DTO
            AppNameCreate appNameCreate = _mapper.Map <WisAppList, AppNameCreate>(wisAppList);

            #region 處理  User Group Name

            if (!string.IsNullOrEmpty(wisAppList.AppUserGroup))
            {
                List <string> groupID = wisAppList.AppUserGroup.Split(',').ToList();

                List <WisDefineGroup> wisDefineGroups = _appListService.GetDefineGroup(groupID);

                string userGroupName = string.Join(",", wisDefineGroups.Select((p, i) => p.GroupName.ToString()));


                appNameCreate.AppUserGroupName = userGroupName;
            }

            #endregion

            //透過 AppOSID  取編輯 資料
            if (appOsType == "IOS")
            {//選取的 AppOSID 為IOS  那 Android 拿取目前已啟動的資料
                editAppIos     = _mapper.Map <WisAppOs, AppOsInfo>(wisAppOs.FirstOrDefault(p => p.OSType == DeviceType.Ios && p.AppOSID.ToString() == appOsID));
                editAppAndroid = _mapper.Map <WisAppOs, AppOsInfo>(wisAppOs.FirstOrDefault(p => p.OSType == DeviceType.Android && p.Status == AppStatus.EnableBool));

                //多載點
                iosAppOsOther = _mapper.Map <List <WisAppOsOther>, List <AppOsOther> >(wisAppOsOthers.Where(p => p.OSType == DeviceType.Ios).ToList());

                //取Android 多載點 得要知道 AppOSId 透過當前 editAppAndroid 的 AppOSId 來取得
                if (editAppAndroid != null)
                {
                    List <WisAppOsOther> androidOthers = _uploadFileService.GetWisAppOsOther(editAppAndroid.AppID, editAppAndroid.AppOSID.ToString());
                    androidAppOsOther = _mapper.Map <List <WisAppOsOther>, List <AppOsOther> >(androidOthers.Where(p => p.OSType == DeviceType.Android).ToList());
                }
            }
            else if (appOsType == "Android")
            {//選取的 AppOSID 為Android  那 IOS 拿取目前已啟動的資料
                editAppIos     = _mapper.Map <WisAppOs, AppOsInfo>(wisAppOs.FirstOrDefault(p => p.OSType == DeviceType.Ios && p.Status == AppStatus.EnableBool));
                editAppAndroid = _mapper.Map <WisAppOs, AppOsInfo>(wisAppOs.FirstOrDefault(p => p.OSType == DeviceType.Android && p.AppOSID.ToString() == appOsID));

                //多載點
                androidAppOsOther = _mapper.Map <List <WisAppOsOther>, List <AppOsOther> >(wisAppOsOthers.Where(p => p.OSType == DeviceType.Android).ToList());

                //取Ios 多載點 得要知道 AppOSId 透過當前 editAppIos 的 AppOSId 來取得
                if (editAppIos != null)
                {
                    List <WisAppOsOther> iosOther = _uploadFileService.GetWisAppOsOther(editAppIos.AppID, editAppIos.AppOSID.ToString());
                    iosAppOsOther = _mapper.Map <List <WisAppOsOther>, List <AppOsOther> >(iosOther.Where(p => p.OSType == DeviceType.Ios).ToList());
                }
            }

            //歷史紀錄
            List <AppOsInfo> appIosHistory     = _mapper.Map <List <WisAppOs>, List <AppOsInfo> >(wisAppOs.Where(p => p.OSType == DeviceType.Ios && p.DelFlag == false)?.OrderByDescending(p => p.CreateDT).Take(10).ToList());
            List <AppOsInfo> appAndroidHistory = _mapper.Map <List <WisAppOs>, List <AppOsInfo> >(wisAppOs.Where(p => p.OSType == DeviceType.Android && p.DelFlag == false)?.OrderByDescending(p => p.CreateDT).Take(10).ToList());

            //圖片資訊
            List <AppPhotoContent> iosPhoto     = _mapper.Map <List <WisAppPhoto>, List <AppPhotoContent> >(wisAppPhoto.Where(p => p.AppOS == DeviceType.Ios).ToList());
            List <AppPhotoContent> androidPhoto = _mapper.Map <List <WisAppPhoto>, List <AppPhotoContent> >(wisAppPhoto.Where(p => p.AppOS == DeviceType.Android).ToList());

            //IOS
            if (editAppIos != null)
            {
                editAppIos.AppName         = wisAppList.AppName;
                editAppIos.AppNameEn       = wisAppList.AppNameEn;
                editAppIos.CompanyApp      = appNameCreate.CompanyApp;
                editAppIos.Photo           = iosPhoto;
                editAppIos.AppOsHistory    = appIosHistory ?? new List <AppOsInfo>();
                editAppIos.DownloadUrlList = iosAppOsOther.Select(p => new DownloadUrlList {
                    Site = p.Site, Url = p.FilePath
                }).ToList();
            }
            else
            {
                //為 null 代表是只建立 app Name 而已 但是一定有 App ID 因為一定有建立 Create App name
                editAppIos = new AppOsInfo
                {
                    AppID           = appID,
                    AppName         = wisAppList.AppName,
                    AppNameEn       = wisAppList.AppNameEn,
                    OSType          = DeviceType.Ios,
                    Status          = true,
                    WebDownFlag     = false,
                    Photo           = iosPhoto,
                    CompanyApp      = appNameCreate.CompanyApp,
                    AppOsHistory    = appIosHistory ?? new List <AppOsInfo>(),
                    DownloadUrlList = new List <DownloadUrlList>()
                };
            }

            //Android
            if (editAppAndroid != null)
            {
                editAppAndroid.AppName         = wisAppList.AppName;
                editAppAndroid.AppNameEn       = wisAppList.AppNameEn;
                editAppAndroid.CompanyApp      = appNameCreate.CompanyApp;
                editAppAndroid.Photo           = androidPhoto;
                editAppAndroid.AppOsHistory    = appAndroidHistory ?? new List <AppOsInfo>();
                editAppAndroid.DownloadUrlList = androidAppOsOther.Select(p => new DownloadUrlList {
                    Site = p.Site, Url = p.FilePath
                }).ToList();
            }
            else
            {
                //為 null 代表是只建立 app Name 而已 但是一定有 App ID 因為一定有建立 Create App name
                editAppAndroid = new AppOsInfo
                {
                    AppID           = appID,
                    AppName         = wisAppList.AppName,
                    AppNameEn       = wisAppList.AppNameEn,
                    OSType          = DeviceType.Android,
                    Status          = true,
                    WebDownFlag     = false,
                    Photo           = androidPhoto,
                    CompanyApp      = appNameCreate.CompanyApp,
                    AppOsHistory    = appAndroidHistory ?? new List <AppOsInfo>(),
                    DownloadUrlList = new List <DownloadUrlList>()
                };
            }

            AppEditViewModel appEditViewModel = new AppEditViewModel
            {
                AppName    = appNameCreate,
                AppIos     = editAppIos,
                AppAndroid = editAppAndroid
            };

            return(TResult <AppEditViewModel> .OK(appEditViewModel, "OK"));
        }
Exemplo n.º 52
0
 private ExecutionInfo(ExecutionDemarcation demarcation, TResult result)
 {
     _demarcation = demarcation;
     _result      = result;
 }
Exemplo n.º 53
0
        public IActionResult DoDeleteFile([FromBody] AppDeleteRequest request)
        {
            TResult <bool> response = _appBiz.DeleteFile(request.AppId, request.AppOsId);

            return(Json(response));
        }