Exemplo n.º 1
0
        protected void AjaxManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            AjaxArguments args=new AjaxArguments(e);
            if(args.CommandName=="RunSearch")
            {
                string appId = args[0];
                string customerId = args[1];
                string result=null;

                using (var mgr=new ApplicationManager() )
                {
                    IApplication app = mgr.GetById(appId);
                    if(app!=null && app.CustomerID==customerId)
                    {
                        result = app.ID + "|" + app.DateApplied.GetValueOrDefault().ToString("yyyy年MM月dd日") + "|" +
                                 (app.Status == null
                                     ? JobStatus.None.ToLabel()
                                     : app.Status.Value);
                    }
                }

                AjaxManager.ResponseScripts.Add((result == null ? "ShowResult(null);" : "ShowResult('" + result + "');") +
                                                " return false;");
            }
        }
Exemplo n.º 2
0
        protected override void ListDataBinding()
        {
            DataTable source;
                switch (EntityName)
                {
                    case "User":
                        using (var manager = new UserManager())
                        {
                            source = manager.GetSource(new Dictionary<IAttributeDefinition, object>(), PagingSetting);
                        }
                        break;
                    case "Application":
                        using (var manager = new ApplicationManager())
                        {
                            var criterias = new Dictionary<IAttributeDefinition, object>();
                            if(this.Current.IsLogon)
                                criterias.Add(AppCore.AppSingleton.FindObjDef<UserObjDef>().Role,this.Current.LogonUser.Role.GetValueOrDefault(UserRole.Client));
                            source = manager.GetSource(criterias, PagingSetting);
                        }
                        break;
                    case "Customer":
                        using (var manager = new CustomerManager())
                        {
                            source = manager.GetSource(new Dictionary<IAttributeDefinition, object>(), PagingSetting);
                        }
                        break;
                    default:
                        source = new DataTable("NoValue");
                        break;
                }

                ObjectList.MasterTableView.DataSource = source;
                ObjectList.MasterTableView.CurrentPageIndex = PagingSetting.PageNum;
                ObjectList.MasterTableView.VirtualItemCount = PagingSetting.ItemCount;
        }
Exemplo n.º 3
0
        protected override bool ListDeleteItem(object sender, GridCommandEventArgs e)
        {
            try
            {
                var item = e.Item as GridDataItem;

                string id = (item.DataItem as DataRowView)["ID"].ToString();
                object result = null;

                switch (EntityName)
                {
                    case "User":
                        using (var manager = new UserManager())
                        {
                            result = manager.Delete(id);
                        }
                        break;
                    case "Application":
                        using (var manager = new ApplicationManager())
                        {
                            result = manager.Delete(id);
                        }
                        break;
                    default:
                        break;
                }

                if (result != null)
                {
                    ObjectList.DataBind();
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception)
            {
                return false;
            }
        }
Exemplo n.º 4
0
        protected void AjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            AjaxArguments args = new AjaxArguments(e);

            switch (args.CommandName)
            {
                case "ChangeStatus":
                    string status = args[0];
                    if (!string.IsNullOrEmpty(ItemId))
                    {
                        using (var manager = new StatusManager())
                        {
                            manager.Update(ItemId, status);
                            InitializeStatusInput(status);
                            Dialog.Info(this, "状态更新成功!");
                        }
                        //btStatus.Visible = true;
                    }
                    break;
                case "InitStatus":
                    string appid = args[0];
                    if (!string.IsNullOrEmpty(appid))
                    {
                        using (var manager = new ApplicationManager())
                        {
                            IApplication app = manager.GetById(appid);
                            if (app.Status != null)
                            {
                                InitializeStatusInput(app.Status.Value);
                            }
                        }
                        //btStatus.Visible = true;
                    }
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 5
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            AjaxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(AjaxManager_AjaxRequest);

            if(string.IsNullOrEmpty(ItemId))
            {
                lbAppId.Text = GlobalConstant.None;
                btStatus.Visible = false;
            }
            else
            {
                lbAppId.Text = ItemId;
                btStatus.Visible = true;
            }

            if(!this.Current.IsLogon)return;

            //0:App details
            //1:collection
            //2:case
            //3:return
            switch (this.Current.LogonUser.Role)
            {
                case UserRole.Client:
                    RadPanelBar1.Items[1].Visible = true;
                    RadPanelBar1.Items[2].Visible = false;
                    break;
                case UserRole.Administrator:
                    RadPanelBar1.Items[1].Visible = true;
                    RadPanelBar1.Items[2].Visible = true;
                    break;
                case UserRole.Business:
                    RadPanelBar1.Items[1].Visible = false;
                    RadPanelBar1.Items[2].Visible = true;
                    break;
                default:
                    break;
            }

            if (!string.IsNullOrEmpty(ItemId))
            {
                using (var manager = new ApplicationManager())
                {
                    IApplication item = manager.GetById(ItemId);

                    string curStatus = item.Status.Value;
                    InitializeStatusInput(curStatus);
                }
            }
        }