Exemplo n.º 1
0
        //検索処理
        private List <tblAgentWeekShift> SearchData(string pageIndex, string pageSize, string pageTotal, string vAgentID)
        {
            List <tblAgentWeekShift> result = new List <tblAgentWeekShift>();

            int currentPageIndex = m_CurPageIndex;
            int currentPageSize  = m_CurrentPageSize;

            int.TryParse(pageIndex, out currentPageIndex);
            int.TryParse(pageSize, out currentPageSize);

            m_CurPageIndex    = currentPageIndex;
            m_CurrentPageSize = currentPageSize;

            string strSortField = GetSortField(m_SortField);
            string strSort      = AppFunction.GetSortDefine(m_Sort);

            ViewBag.vTenantID         = this.TenantID;
            ViewBag.vTenantSpeciaFlag = this.TenantSpecialFlag;
            //ページを再計算する
            CalcPage(pageTotal);

            using (WFMDBDataContext db = new WFMDBDataContext())
            {
                IMultipleResults results = db.uspWFMSearchShiftAgentWeekPaged(m_CurPageIndex, m_CurrentPageSize, strSortField, strSort,
                                                                              this.TenantID, this.TenantSpecialFlag, vAgentID);

                result = results.GetResult <tblAgentWeekShift>().ToList();
                tblDataPaged tblPage = results.GetResult <tblDataPaged>().FirstOrDefault();

                m_TotalRowCount  = tblPage.TotalRowCount;
                m_CurPageIndex   = tblPage.CurPageIndex;
                m_TotlePageCount = tblPage.TotalPageCount;
            }

            return(result);
        }
Exemplo n.º 2
0
        //検索処理
        private List <tblAgentDetailV3> SearchData(string pageIndex, string pageSize, string pageTotal, DateTime dtST, DateTime dtEnd, string vLogin, int iAgentStatus)
        {
            List <tblAgentDetailV3> result = new List <tblAgentDetailV3>();

            int currentPageIndex = m_CurPageIndex;
            int currentPageSize  = m_CurrentPageSize;

            int.TryParse(pageIndex, out currentPageIndex);
            int.TryParse(pageSize, out currentPageSize);

            m_CurPageIndex    = currentPageIndex;
            m_CurrentPageSize = currentPageSize;

            string strSortField = GetSortField(m_SortField);
            string strSort      = AppFunction.GetSortDefine(m_Sort);

            ViewBag.vTenantID         = this.TenantID;
            ViewBag.vTenantSpeciaFlag = this.TenantSpecialFlag;
            //ページを再計算する
            CalcPage(pageTotal);

            using (WFMDBDataContext db = new WFMDBDataContext(string.Format(System.Configuration.ConfigurationManager.ConnectionStrings["SpecialConnection"].ConnectionString, DBServer)))
            {
                IMultipleResults results = db.uspWFMGetAgentDetailV3(m_CurPageIndex, m_CurrentPageSize, strSortField, strSort,
                                                                     this.TenantID, dtST.ToString(AppConst.Const_Format_YMDHMS), dtEnd.ToString(AppConst.Const_Format_YMDHMS), vLogin, iAgentStatus);

                result = results.GetResult <tblAgentDetailV3>().ToList();
                tblDataPaged tblPage = results.GetResult <tblDataPaged>().FirstOrDefault();

                m_TotalRowCount  = tblPage.TotalRowCount;
                m_CurPageIndex   = tblPage.CurPageIndex;
                m_TotlePageCount = tblPage.TotalPageCount;
            }

            return(result);
        }
Exemplo n.º 3
0
        private void CreateDefaultChildren()
        {
            List <AppFunction> children       = new List <AppFunction>();
            string             controllerName = this.GetType().FullName;

            children.Add(new AppFunction
            {
                AuthType  = JAuthType.AllUsers,
                IconClass = "icon-new-edit",
                ParentId  = Function.Id,
                Id        = "DefaultAdd-" + Function.Id,
                LogType   = AppCenter.Logs.JLogType.Info,
                Visible   = VisibleType.Button | VisibleType.Menu,
                Ord       = 1,
                Name      = "新增",
            });

            children.Add(new AppFunction
            {
                AuthType  = JAuthType.AllUsers,
                IconClass = "icon-new-edit",
                ParentId  = Function.Id,
                Id        = "DefaultEdit-" + Function.Id,
                LogType   = AppCenter.Logs.JLogType.Info,
                Visible   = VisibleType.Button | VisibleType.Menu,
                Ord       = 2,
                Name      = "编辑",
            });
            children.Add(new AppFunction
            {
                AuthType       = JAuthType.AllUsers,
                IconClass      = "icon-new-delete",
                ParentId       = Function.Id,
                Id             = "DefaultDelete-" + Function.Id,
                Method         = WebMethod.POST,
                LogType        = AppCenter.Logs.JLogType.Info,
                ActionName     = "Delete",
                ControllerName = controllerName,
                Location       = Url.Action("Delete"),
                Visible        = VisibleType.Button | VisibleType.Menu,
                Ord            = 3,
                Name           = "删除",
            });

            var editPage = new AppFunction
            {
                AuthType       = JAuthType.AllUsers,
                ParentId       = Function.Id,
                Id             = "editpage-" + Function.Id,
                Method         = WebMethod.GET,
                LogType        = AppCenter.Logs.JLogType.Info,
                ActionName     = "Edit",
                ControllerName = controllerName,
                Location       = Url.Action("Edit"),
                Visible        = VisibleType.Role,
                Ord            = 3,
                Name           = "编辑页",
            };

            children.Add(editPage);

            children.Add(new AppFunction
            {
                AuthType       = JAuthType.AllUsers,
                IconClass      = "icon-new-save",
                ParentId       = editPage.Id,
                Id             = "DefaultSave-" + editPage.Id,
                Method         = WebMethod.POST,
                LogType        = AppCenter.Logs.JLogType.Info,
                ActionName     = "Edit",
                ControllerName = controllerName,
                Location       = Url.Action("Edit"),
                Visible        = VisibleType.Button | VisibleType.Menu,
                Ord            = 1,
                Name           = "保存",
            });
            children.Add(new AppFunction
            {
                AuthType       = JAuthType.AllUsers,
                IconClass      = "icon-new-copy",
                ParentId       = editPage.Id,
                Id             = "DefaultCopy-" + editPage.Id,
                Method         = WebMethod.POST,
                LogType        = AppCenter.Logs.JLogType.Info,
                ActionName     = "Copy",
                ControllerName = controllerName,
                Location       = Url.Action("Copy"),
                Visible        = VisibleType.Button | VisibleType.Menu,
                Ord            = 2,
                Name           = "复制",
            });
            children.Add(new AppFunction
            {
                AuthType  = JAuthType.AllUsers,
                IconClass = "icon-new-return",
                ParentId  = editPage.Id,
                Id        = "DefaultReturn-" + Function.Id,
                Visible   = VisibleType.Button | VisibleType.Menu,
                Ord       = 3,
                Name      = "返回",
            });

            var rule = ModelRule.Get <TModel>();

            //添加子表Grid上方工具栏按钮
            foreach (var r in rule.CollectionRules)
            {
                var detailMenu = new AppFunction
                {
                    AuthType  = JAuthType.AllUsers,
                    IconClass = "icon-new-add",
                    ParentId  = editPage.Id,
                    Id        = r.Name + "-" + editPage.Id,
                    Visible   = VisibleType.QuckAccessBar,
                    Ord       = 1,
                    Name      = r.Name,
                };
                children.Add(detailMenu);
                children.Add(new AppFunction
                {
                    AuthType  = JAuthType.AllUsers,
                    IconClass = "icon-new-add",
                    ParentId  = detailMenu.Id,
                    Id        = "DefaultAdd-" + detailMenu.Id,
                    Visible   = VisibleType.Button | VisibleType.Menu,
                    Ord       = 1,
                    Name      = "新增",
                });
                children.Add(new AppFunction
                {
                    AuthType  = JAuthType.AllUsers,
                    IconClass = "icon-new-delete",
                    ParentId  = detailMenu.Id,
                    Id        = "DefaultDelete-" + r.Name + "-" + editPage.Id,
                    Visible   = VisibleType.Button | VisibleType.Menu,
                    Ord       = 2,
                    Name      = "删除",
                });
            }

            foreach (var func in children)
            {
                AppManager.Instance.FunctionManager.Add(func);
            }
        }
 /// <summary>
 /// 生成POST的Action的URL规则
 /// </summary>
 /// <param name="child"></param>
 /// <param name="info"></param>
 private void MakePostRegTail(AppFunction child, MvcFuncInfo info)
 {
     child.LocationSamples = child.Location + Environment.NewLine + child.Location + "/123";
     child.RegTail         = "(/\\d*)?";
 }
        /// <summary>
        /// 根据程序集反射出所有的需权限的控制器和功能
        /// </summary>
        /// <param name="rootTree">程序集根结点</param>
        /// <param name="assembly">程序集</param>
        void GetFunctions(JTree <AppFunction> rootTree, Assembly assembly)
        {
            var functionInfos =
                (from t in assembly.GetTypes()
                 where !t.IsAbstract && t.Name.EndsWith("Controller")
                 from m in t.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly)
                 where !m.IsSpecialName
                 select new MvcFuncInfo()
            {
                Controller = t,
                Action = m,
                ControllerName = t.Name.Substring(0, t.Name.Length - 10),
                ActionName = m.Name,
                Parameters = m.GetParameters()
            }).ToList();

            List <AppFunction> functionList = new List <AppFunction>();

            foreach (var groupInfo in functionInfos.GroupBy(f => f.Controller))
            {
                var menu = GetMenu(groupInfo.Key, rootTree.Node.AuthType, rootTree.Node.LogType);

                //生成Controller作为二级的功能项
                AppFunction parent = new AppFunction()
                {
                    Name           = menu.Name,
                    Location       = menu.AreaName + "/" + groupInfo.First().ControllerName,
                    ControllerName = groupInfo.Key.FullName,
                    Visible        = menu.Visible,
                    AuthType       = menu.AuthType,
                    LogType        = menu.LogType,
                    Ord            = menu.Ord,
                };

                if (parent.AuthType == JAuthType.Ignore)
                {
                    continue;
                }

                parent.LocationSamples = parent.Location;
                ReDefineId(menu, parent);
                var parentTree = rootTree.Add(parent);

                //生成Controller下面的Action作为三级的功能项
                foreach (var info in groupInfo)
                {
                    info.AuthType = parent.AuthType;
                    //提取Attributes
                    GetAttributes(info);

                    menu = GetMenu(info);
                    AppFunction child = new AppFunction()
                    {
                        Name     = menu.Name,
                        Location = menu.AreaName + info.ToString(),
                        ParentId = parent.Id,
                        Visible  = menu.Visible,

                        Method    = info.HasPost ? WebMethod.POST : WebMethod.GET,
                        Ord       = menu.Ord,
                        AuthType  = menu.AuthType,
                        Arguments = info.Parameters
                                    .ToDictionary(p => p.Name, p => p.ParameterType.Name.StartsWith("Int") ? @"\d+" : null),
                        LogType        = menu.LogType,
                        ControllerName = parent.ControllerName,
                        ActionName     = info.ActionName
                    };


                    if (child.AuthType == JAuthType.Ignore)
                    {
                        continue;
                    }

                    ReDefineId(menu, child);

                    if (child.Method == WebMethod.GET)
                    {
                        MakeRegTail(child, info);
                    }
                    else
                    {
                        MakePostRegTail(child, info);
                    }
                    parentTree.Add(child);
                }
            }
        }
Exemplo n.º 6
0
 public bool IsExist(AppFunction appFunction)
 {
     return(IsExist(appFunction.Name, appFunction.App, appFunction.AppFunctionType));
 }
Exemplo n.º 7
0
 public ActionResult Index()
 {
     try
     {
         var url = string.Format(AppConst.Const_Cte1ReportUrl + "?u={0}&p={1}", this.TenantID, AppFunction.GetUserPassword(this.TenantID));
         AppLog.WriteLog("url:" + url);
         var models = parseHtml(url);
         AppLog.WriteLog("models information count is " + models.Count().ToString());
         return(View(models.ToList()));
     }
     catch (Exception ex)
     {
         AppLog.WriteLog("Cte1reportController index system error:" + ex.Message + ex.StackTrace);
         return(View());
     }
 }
Exemplo n.º 8
0
        internal static int Update(AppFunction info)
        {
            string sql = "update AppFunction set FunctionName=@FunctionName,PathName=@PathName,Title=@Title,Status=@Status,AppServiceId=@AppServiceId where AppFunctionId=@AppFunctionId";

            return(Update <AppFunction>(con, sql, info));
        }
Exemplo n.º 9
0
        internal static int Add(AppFunction info)
        {
            string sql = "insert into AppFunction(FunctionName,PathName,Title,Status,AppServiceId) select @FunctionName,@PathName,@Title,@Status,@AppServiceId from DUAL where not exists(select AppFuntionId from AppFunction where FunctionName=@FunctionName and AppServiceId=@AppServiceId);select @@IDENTITY;";

            return(InsertWithReturnID <AppFunction, int>(con, sql, info));
        }
        protected void submitButtonClick(Object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    var checkUserName = AppFunction.doesUserNameExist(id_txt_username.Text.Trim());

                    var checkEmail = AppFunction.doesEmailExist(id_txt_email.Text.Trim(), Encryption.createSHA1(id_txt_email.Text.Trim()));

                    BaseResponse serverResponse      = new JavaScriptSerializer().Deserialize <BaseResponse>(checkUserName);
                    BaseResponse serverResponseEmail = new JavaScriptSerializer().Deserialize <BaseResponse>(checkEmail);

                    if (serverResponse.message == "True" || serverResponseEmail.message == "True")
                    {
                        errorDiv.Visible       = true;
                        errorMessage.InnerHtml = Messages.userNameOrEmailExists;
                        return;
                    }
                    else
                    {
                        errorDiv.Visible       = false;
                        errorMessage.InnerHtml = string.Empty;
                    }

                    RequestHandler post = new RequestHandler();
                    post.Url = Constants.ADD_CUSTOMER;
                    post.PostItems.Add("userName", id_txt_username.Text.Trim());
                    post.PostItems.Add("password", id_txt_password.Text.Trim());
                    post.PostItems.Add("token", Encryption.createSHA1(id_txt_username.Text.Trim() + id_txt_password.Text.Trim()));
                    post.PostItems.Add("gender", cbo_gender.Text.Trim());
                    post.PostItems.Add("title", cbo_title.Text.Trim());
                    post.PostItems.Add("mobile", id_txt_mobile.Text.Trim());
                    post.PostItems.Add("email", id_txt_email.Text.Trim());
                    post.PostItems.Add("organizationName", id_txt_org_name.Text.Trim());
                    post.PostItems.Add("telephone", id_txt_telephone.Text.Trim());
                    post.PostItems.Add("lastName", idLastName.Text.Trim());
                    post.PostItems.Add("firstName", idFirstName.Text.Trim());
                    post.PostItems.Add("country", lst_countries.Text.Trim());
                    post.PostItems.Add("address", id_txt_address.Text.Trim());
                    post.PostItems.Add("profilePicURL", null);
                    post.PostItems.Add("role", "AIGROW_CUSTOMER");

                    post.Type = RequestHandler.PostTypeEnum.Post;
                    string result = post.Post();

                    BaseResponse userResponse = new JavaScriptSerializer().Deserialize <BaseResponse>(result);

                    if (userResponse.success == true)
                    {
                        // string userID = new BL_User().getUserIDByUserName(id_txt_username.Text.Trim());

                        Response.Redirect(string.Format("{0}?message={1}&token={2}", Constants.REGISTER_URL, Messages.successfulRegistration.Replace("<email>", id_txt_email.Text.Trim()), Encryption.createSHA1(Messages.successfulRegistration.Replace("<email>", id_txt_email.Text.Trim()))), false);
                    }
                    else
                    {
                        Response.Redirect(string.Format("{0}?error={1}&token={2}", Constants.REGISTER_URL, userResponse.errorMessage, Encryption.createSHA1(userResponse.errorMessage)), false);
                    }
                }
                catch (WebException wex)
                {
                    string pageContent = new StreamReader(wex.Response.GetResponseStream()).ReadToEnd().ToString();
                    Response.Redirect(string.Format("{0}?error={1}&token={2}", Constants.REGISTER_URL, wex.Message, Encryption.createSHA1(wex.Message)), false);
                    return;
                }
            }
            else
            {
                //valSummaryForm.Visible = true;
            }
        }
Exemplo n.º 11
0
 public AuthorizeUserAttribute(AppFunction appFunction)
 {
     _appFunction = appFunction;
 }