Exemple #1
0
        public async Task <IActionResult> GetCompanyView(long companyId)
        {
            CompanyModule invMod = new CompanyModule();

            CompanyView view = await invMod.Company.Query().GetViewById(companyId);

            return(Ok(view));
        }
Exemple #2
0
        public async Task <IActionResult> DeleteCompany([FromBody] CompanyView view)
        {
            CompanyModule invMod  = new CompanyModule();
            Company       company = await invMod.Company.Query().MapToEntity(view);

            invMod.Company.DeleteCompany(company).Apply();

            return(Ok(view));
        }
        public HttpResponseMessage UpdateCompanyModule(HttpRequestMessage request, [FromBody] CompanyModule companyModuleModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var companyModule = _CoreService.UpdateCompanyModule(companyModuleModel);

                return request.CreateResponse <CompanyModule>(HttpStatusCode.OK, companyModule);
            }));
        }
Exemple #4
0
        private void CheckCompanyForModule(Guid?comkey, Guid?moduleKey)
        {
            var t = from x in db.CompanyForm where x.ModuleKey == moduleKey && x.CompanyKey == comkey select x;

            if (!(t.Count() > 0))
            {
                CompanyModule a = db.CompanyModule.SingleOrDefault(x => x.ModuleKey == moduleKey && x.CompanyKey == comkey);
                db.CompanyModule.Remove(a);
                db.SaveChanges();
            }
        }
        public HttpResponseMessage GetCompanyModule(HttpRequestMessage request, int companyModuleId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                CompanyModule companyModule = _CoreService.GetCompanyModule(companyModuleId);

                // notice no need to create a seperate model object since CompanyModule entity will do just fine
                response = request.CreateResponse <CompanyModule>(HttpStatusCode.OK, companyModule);

                return response;
            }));
        }
Exemple #6
0
        public async Task <IActionResult> UpdateCompany([FromBody] CompanyView view)
        {
            CompanyModule invMod = new CompanyModule();

            Company company = await invMod.Company.Query().MapToEntity(view);


            invMod.Company.UpdateCompany(company).Apply();

            CompanyView retView = await invMod.Company.Query().GetViewById(company.CompanyId);


            return(Ok(retView));
        }
Exemple #7
0
        public CompanyModule Edit(CompanyModule model)
        {
            DALBase <CompanyModule, DataContext> bll = new DALBase <CompanyModule, DataContext>();

            if (model.id == 0)
            {
                model = bll.AddReturnModel(model);
            }
            else
            {
                bll.AddOrUpdate(model);
            }
            return(model);
        }
Exemple #8
0
        private void AddModulesToCompany(Forms obj, Guid id)
        {
            var t = from x in db.CompanyModule where x.ModuleKey == obj.ModuleID && x.CompanyKey == id select x;

            if (!(t.Count() > 0))
            {
                db = new HasanHoutoneEntities();
                CompanyModule a = new CompanyModule();
                a.CompanyModuleID = Guid.NewGuid();
                a.CompanyKey      = id;
                a.ModuleKey       = obj.ModuleID;
                db.CompanyModule.Add(a);
                db.SaveChanges();
            }
        }
Exemple #9
0
 public void SMK02_VerifyCompanyCreationWithAdmin()
 {
     TestGroupName = GetType().Name;
     TestName      = TestContext.TestName;
     CreateFolders(TestGroupName, TestName);
     try
     {
         CompanyModule.CreateACompany(TestGroupName, TestName);
         LoginModule.Logout(TestGroupName, TestName);
     }
     catch (Exception e)
     {
         _verificationErrors.Append(e.Message);
         Assert.Fail(e.Message);
     }
 }
Exemple #10
0
        public static void Setup()
        {
            Console.WriteLine("E3");
            Driver = GetWebDriver(ConfigurationSettings.AppSettings["browser"]);
            string baseUrl = ConfigurationSettings.AppSettings["baseUrl"];

            Console.WriteLine("E4");
            Driver.Manage().Window.Maximize();
            Driver.Navigate().GoToUrl(baseUrl);
            LoginModule        = new LoginModule(Driver);
            CompanyModule      = new CompanyModule(Driver);
            DashboardModule    = new DashboardModule(Driver);
            ArtistModule       = new ArtistModule(Driver);
            GroupModule        = new GroupModule(Driver);
            ContentModule      = new ContentModule(Driver);
            ElementPresentTest = new ElementPresentTest(Driver);
        }
Exemple #11
0
        public async Task <IActionResult> AddCompany([FromBody] CompanyView view)
        {
            CompanyModule invMod = new CompanyModule();

            NextNumber nnCompany = await invMod.Company.Query().GetNextNumber();

            view.CompanyNumber = nnCompany.NextNumberValue;

            Company company = await invMod.Company.Query().MapToEntity(view);

            invMod.Company.AddCompany(company).Apply();

            CompanyView newView = await invMod.Company.Query().GetViewByNumber(view.CompanyNumber);


            return(Ok(newView));
        }
        public HttpResponseMessage DeleteCompanyModule(HttpRequestMessage request, [FromBody] int companyModuleId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                CompanyModule companyModule = _CoreService.GetCompanyModule(companyModuleId);

                if (companyModule != null)
                {
                    _CoreService.DeleteCompanyModule(companyModuleId);

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                else
                {
                    response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No companyModule found under that ID.");
                }

                return response;
            }));
        }
        public virtual List <Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine> GetResponsibilitiesReportData(IEmployee employee)
        {
            var result = new List <Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine>();
            // HACK: Получаем отображаемое имя модуля.
            var moduleGuid     = new CompanyModule().Id;
            var moduleName     = Sungero.Metadata.Services.MetadataSearcher.FindModuleMetadata(moduleGuid).GetDisplayName();
            var modulePriority = Company.Constants.ResponsibilitiesReport.CompanyPriority;

            // Должность.
            result = AppendResponsibilitiesReportResult(result, employee.JobTitle, moduleName, modulePriority, Resources.Jobtitle);

            // Подразделения.
            if (Departments.AccessRights.CanRead())
            {
                var employeeDepartments = Departments.GetAll()
                                          .Where(d => d.RecipientLinks.Any(e => Equals(e.Member, employee)))
                                          .Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active);
                result = AppendResponsibilitiesReportResult(result, employeeDepartments, moduleName, modulePriority, Resources.Departments, employee.Department);
            }

            // НОР.
            if (Departments.AccessRights.CanRead() &&
                BusinessUnits.AccessRights.CanRead())
            {
                var businessUnits = Departments.GetAll()
                                    .Where(d => d.RecipientLinks.Any(e => Equals(e.Member, employee)))
                                    .Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active)
                                    .Select(b => b.BusinessUnit)
                                    .Where(b => b.Status == Sungero.CoreEntities.DatabookEntry.Status.Active).Distinct();
                result = AppendResponsibilitiesReportResult(result, businessUnits, moduleName, modulePriority, Resources.BusinessUnits, employee.Department.BusinessUnit);
            }

            // Руководитель подразделений.
            if (Departments.AccessRights.CanRead())
            {
                var managerOfDepartments = Departments.GetAll().Where(d => Equals(d.Manager, employee))
                                           .Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active);
                result = AppendResponsibilitiesReportResult(result, managerOfDepartments, moduleName, modulePriority, Resources.ManagerOfDepartmens);
            }

            // Руководители НОР.
            if (BusinessUnits.AccessRights.CanRead())
            {
                var businessUnitsCEO = BusinessUnits.GetAll().Where(b => Equals(b.CEO, employee))
                                       .Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active);
                result = AppendResponsibilitiesReportResult(result, businessUnitsCEO, moduleName, modulePriority, Resources.BusinessUnitsCEO);
            }

            // Роли.
            if (Roles.AccessRights.CanRead())
            {
                var roles = Roles.GetAll().Where(r => r.RecipientLinks.Any(e => Equals(e.Member, employee)))
                            .Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active);
                result = AppendResponsibilitiesReportResult(result, roles, moduleName, modulePriority, Resources.Roles);
            }

            // Помощники руководителей.
            if (ManagersAssistants.AccessRights.CanRead())
            {
                var managersAssistants = ManagersAssistants.GetAll()
                                         .Where(m => Equals(m.Assistant, employee) || Equals(m.Manager, employee))
                                         .Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active)
                                         .ToDictionary <IEntity, IEntity, string>(x => x,
                                                                                  x => string.Format("{0}: {1}{2}{3}: {4}",
                                                                                                     Resources.Manager,
                                                                                                     PublicFunctions.Employee.GetShortName(ManagersAssistants.As(x).Manager, false),
                                                                                                     Environment.NewLine,
                                                                                                     Resources.Assistant,
                                                                                                     PublicFunctions.Employee.GetShortName(ManagersAssistants.As(x).Assistant, false)));
                result = AppendResponsibilitiesReportResult(result, managersAssistants, moduleName, modulePriority + result.Count, Resources.ManagersAssistants);
            }

            // Замещения.
            if (Substitutions.AccessRights.CanRead())
            {
                var substitutions = Substitutions.GetAll()
                                    .Where(s => (Equals(s.Substitute, employee) ||
                                                 Equals(s.User, employee)) &&
                                           (!s.EndDate.HasValue || s.EndDate >= Calendar.UserToday))
                                    .Where(s => s.IsSystem != true)
                                    .ToDictionary <IEntity, IEntity, string>(x => x, x => CreateSubstitutionPresentation(Substitutions.As(x)));
                result = AppendResponsibilitiesReportResult(result, substitutions, moduleName, modulePriority + result.Count, Resources.Substitutions);
            }

            return(result);
        }
Exemple #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SortedDictionary <string, string> sPara = GetRequestGet();
        string types = "1", sn = "";

        if (sPara.Count > 0)//判断是否有带返回参数
        {
            //BLL.Recharge bll = new BLL.Recharge();
            //BLL.Users userBll = new BLL.Users();
            string order_no = Request.QueryString["out_trade_no"];          //获取订单号

            //Model.Recharge info = bll.GetModel("Sn='" + order_no + "'");
            //if (info != null)
            //{
            //    RechType = info.RechType;//用来区分的
            //    types = (RechType == 0 ? "1" : "2");
            //    sn = info.Sn;
            //}
            Notify aliNotify = new Notify(types);
            Service_PlanAgentOrder.PlanAgentOrderClient bll = new Service_PlanAgentOrder.PlanAgentOrderClient();
            __OrderInfo = bll.Info(0, order_no);
            bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);
            Service_SystemModuleSetMeal.SystemModuleSetMealClient             setMealBLL       = new Service_SystemModuleSetMeal.SystemModuleSetMealClient();
            Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient setMealDetailBll = new Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient();
            __SetMealList = setMealBLL.ListByIds(__OrderInfo.RelationId);
            foreach (SystemModuleSetMeal item in __SetMealList)
            {
                V_SystemModuleSetMealDetail[] moduleList = setMealDetailBll.List(item.id);
                foreach (V_SystemModuleSetMealDetail moduleItem in moduleList)
                {
                    moduleItem.Day = item.Day;
                    if (__ModuleList.Where(m => m.SystemModuleId == moduleItem.SystemModuleId).ToArray().Length > 0)
                    {
                        __ModuleList.Where(m => m.SystemModuleId == moduleItem.SystemModuleId).ToArray()[0].Day += moduleItem.Day;
                    }
                    else
                    {
                        __ModuleList.Add(moduleItem);
                    }
                }
                __SetMealNames += item.Name + ",";
            }

            if (verifyResult && __OrderInfo.State == 0)//验证成功
            {
                if (__OrderInfo.Type == 1)
                {
                    string[] setMealIdArr = __OrderInfo.RelationId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    Service_Message.MessageClient msgBll = new Service_Message.MessageClient();
                    Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient logBll = new Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient();
                    foreach (string idItem in setMealIdArr)
                    {
                        string moduleIds = "", moduleNames = "";
                        SystemModuleSetMeal                       setMealInfo = setMealBLL.Info(Convert.ToInt32(idItem));
                        V_SystemModuleSetMealDetail[]             detailList = setMealDetailBll.List(setMealInfo.id);
                        Service_CompanyModule.CompanyModuleClient companyModuleBll = new Service_CompanyModule.CompanyModuleClient();
                        foreach (V_SystemModuleSetMealDetail item in detailList)
                        {
                            CompanyModule moduleInfo = companyModuleBll.InfoByModule(__OrderInfo.CompanyId, item.SystemModuleId);
                            moduleNames += Enum.GetName(typeof(ModuleType), item.SystemModuleId) + ",";
                            moduleIds   += moduleInfo.id + ",";
                            if (moduleInfo == null)
                            {
                                moduleInfo = new CompanyModule()
                                {
                                    CompanyId         = __OrderInfo.CompanyId,
                                    ModuleId          = item.SystemModuleId,
                                    ValidityDateStart = DateTime.Now,
                                    ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day)
                                };
                            }
                            else
                            {
                                if (moduleInfo.ValidityDateEnd.CompareTo(DateTime.Now) == -1)//已过期
                                {
                                    moduleInfo.ValidityDateStart = DateTime.Now;
                                    moduleInfo.ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day);
                                }
                                else
                                {
                                    if (moduleInfo.ValidityDateEnd.CompareTo(DateTime.Now.AddDays(setMealInfo.Day)) == -1)
                                    {
                                        moduleInfo.ValidityDateEnd = DateTime.Now.AddDays(setMealInfo.Day);
                                    }
                                }
                            }
                            companyModuleBll.Edit(moduleInfo);
                        }
                        logBll.Add(new SystemModuleSetMealValidityLog()
                        {
                            CompanyId         = __OrderInfo.CompanyId,
                            ModuleIds         = moduleIds,
                            OrderId           = __OrderInfo.id,
                            ModuleNames       = moduleNames,
                            SetMealName       = setMealInfo.Name,
                            SetMealId         = setMealInfo.id,
                            ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day),
                            ValidityDateStart = DateTime.Now
                        });
                        msgBll.AddSystemMessage(LoginUserId, "套餐购买", string.Format("成功购买{0}套餐", __SetMealNames.TrimEnd(',')));
                    }
                    logBll.Abort();
                    logBll.Close();
                }
                bll.UpdateState(__OrderInfo.Sn, 1);
            }
            setMealBLL.Abort();
            setMealBLL.Close();
        }
    }
        public List <SystemModule> ListByCompany(long companyId, string domain, long userId)
        {
            Expression <Func <SystemModule, bool> > condition = null;
            List <SystemModule> list = new DALBase <SystemModule, DataContext>().List(condition, m => m.OrderBy);

            if (!string.IsNullOrEmpty(domain))
            {
                Company companyInfo = new DALBase <Company, DataContext>().Info(m => m.Domain == domain);
                if (companyInfo == null)
                {
                    return(null);
                }
                companyId = companyInfo.CompanyId;
            }
            Expression <Func <CompanyModule, bool> > companyCondition = m => m.CompanyId == companyId;
            List <CompanyModule> companyList = new DALBase <CompanyModule, DataContext>().List(companyCondition, m => m.id);

            //new Camel.ApiUserBLL.UserPowerExBLL().
            Camel.ApiModel.CompanyManageUser userModule = Camel.ApiUserBLL.UserPowerExBLL.CompanyManageGet(companyId, userId);
            if (userModule == null)
            {
                return(null);
            }
            foreach (SystemModule item in list)
            {
                if (userModule.RoleTypeId == 1)//超级用户
                {
                    if (item.IsDefault ||
                        companyId == 1)
                    {
                        item.State = 0;
                        continue;
                    }
                    if (companyList.Where(m => m.ModuleId == item.id).ToArray().Length > 0)
                    {
                        CompanyModule existModel = companyList.Where(m => m.ModuleId == item.id).ToArray()[0];

                        if (existModel.ValidityDateEnd >= DateTime.Now && existModel.ValidityDateStart <= DateTime.Now)
                        {
                            item.State = 0;
                        }
                        else//过期
                        {
                            item.State = 1;
                        }
                    }
                    else//未开通
                    {
                        item.State = 2;
                    }
                }
                else//普通用户
                {
                    if (
                        (companyList.Where(m => m.ModuleId == item.id).ToArray().Length > 0 || item.IsDefault) &&//企业有模块使用权
                        userModule._UserPowerExLst.Where(m => m.ModuleId == item.id).ToArray().Length > 0   //用户仍有操作权限
                        )
                    {
                        if (item.IsDefault ||
                            companyId == 1)
                        {
                            item.State = 0;
                            continue;
                        }

                        CompanyModule existModel = companyList.Where(m => m.ModuleId == item.id).ToArray()[0];
                        if (existModel.ValidityDateEnd >= DateTime.Now && existModel.ValidityDateStart <= DateTime.Now)

                        {
                            item.State = 0;
                        }
                        else//过期
                        {
                            item.State = 3;
                        }
                    }
                    else
                    {
                        item.State = 3;
                    }
                }
            }
            return(list);
        }
Exemple #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SortedDictionary <string, string> sPara = GetRequestPost();
        int    RechType = 0;
        string types = "1", sn = "";

        if (sPara.Count > 0)                                           //判断是否有带返回参数
        {
            string order_no = Request.Form["out_trade_no"].ToString(); //获取订单号


            Notify aliNotify    = new Notify(types);
            bool   verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]);


            if (verifyResult)//验证成功
            {
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //请在这里加上商户的业务逻辑程序代码

                //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
                string trade_no = Request.Form["trade_no"];         //支付宝交易号
                if (string.IsNullOrEmpty(trade_no))
                {
                    HttpContext.Current.Response.Write("参数错误");
                    HttpContext.Current.Response.End();
                }
                string total_fee    = Request.Form["total_fee"];    //获取总金额
                string subject      = Request.Form["subject"];      //商品名称、订单名称
                string body         = Request.Form["body"];         //商品描述、订单备注、描述
                string buyer_email  = Request.Form["buyer_email"];  //买家支付宝账号
                string trade_status = Request.Form["trade_status"]; //交易状态
                Service_PlanAgentOrder.PlanAgentOrderClient bll = new Service_PlanAgentOrder.PlanAgentOrderClient();
                PlanAgentOrder orderInfo = bll.Info(0, order_no);
                if (orderInfo.State == 0)
                {
                    if (orderInfo.Type == 1)
                    {
                        Service_SystemModuleSetMeal.SystemModuleSetMealClient setMealBLl = new Service_SystemModuleSetMeal.SystemModuleSetMealClient();
                        string[] setMealIdArr = orderInfo.RelationId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient logBll = new Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient();
                        foreach (string idItem in setMealIdArr)
                        {
                            SystemModuleSetMeal setMealInfo = setMealBLl.Info(Convert.ToInt32(idItem));
                            string moduleIds = "", moduleNames = "";
                            Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient setMealDetailBll = new Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient();
                            V_SystemModuleSetMealDetail[]             detailList = setMealDetailBll.List(setMealInfo.id);
                            Service_CompanyModule.CompanyModuleClient companyModuleBll = new Service_CompanyModule.CompanyModuleClient();
                            foreach (V_SystemModuleSetMealDetail item in detailList)
                            {
                                moduleIds   += item.SystemModuleId + ",";
                                moduleNames += Enum.GetName(typeof(ModuleType), item.SystemModuleId) + ",";
                                CompanyModule moduleInfo = companyModuleBll.InfoByModule(orderInfo.CompanyId, item.SystemModuleId);
                                if (moduleInfo == null)
                                {
                                    moduleInfo = new CompanyModule()
                                    {
                                        CompanyId         = orderInfo.CompanyId,
                                        ModuleId          = item.SystemModuleId,
                                        ValidityDateStart = DateTime.Now,
                                        ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day)
                                    };
                                }
                                else
                                {
                                    if (moduleInfo.ValidityDateEnd.CompareTo(DateTime.Now) == -1)//已过期
                                    {
                                        moduleInfo.ValidityDateStart = DateTime.Now;
                                        moduleInfo.ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day);
                                    }
                                    else
                                    {
                                        if (moduleInfo.ValidityDateEnd.CompareTo(DateTime.Now.AddDays(setMealInfo.Day)) == -1)
                                        {
                                            moduleInfo.ValidityDateEnd = DateTime.Now.AddDays(setMealInfo.Day);
                                        }
                                    }
                                }
                                companyModuleBll.Edit(moduleInfo);
                            }
                            logBll.Add(new SystemModuleSetMealValidityLog()
                            {
                                CompanyId         = orderInfo.CompanyId,
                                ModuleIds         = moduleIds,
                                ModuleNames       = moduleNames,
                                SetMealName       = setMealInfo.Name,
                                OrderId           = orderInfo.id,
                                SetMealId         = setMealInfo.id,
                                ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day),
                                ValidityDateStart = DateTime.Now
                            });
                        }
                        logBll.Abort();
                        logBll.Close();
                        setMealBLl.Abort();
                        setMealBLl.Close();
                    }
                    bll.UpdateState(order_no, 1);
                    bll.Abort();
                    bll.Close();
                }

                Response.Write("success");  //请不要修改或删除

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
            }
            else//验证失败
            {
                Response.Write("fail");
            }
        }
        else
        {
            Response.Write("无通知参数");
        }
        //context.Response.Write("Hello World");
    }
Exemple #17
0
        public int VerifyCheck(long companyId, long userId, int moduleId, int fnId)
        {
            //return 0;
            DALBase <CompanyModule, DataContext> bll = new DALBase <CompanyModule, DataContext>();
            CompanyModule info = bll.Info(m => m.ModuleId == moduleId && m.CompanyId == companyId);
            DALBase <SystemModule, DataContext>     baseModuleBll = new DALBase <SystemModule, DataContext>();
            Expression <Func <SystemModule, bool> > baseCondition = m => m.IsDefault == true;
            List <SystemModule> baseList = baseModuleBll.List(baseCondition, m => m.id);

            Camel.ApiModel.CompanyManageUser userModule = Camel.ApiUserBLL.UserPowerExBLL.CompanyManageGet(companyId, userId);
            if (baseList.Where(m => m.id == moduleId).ToArray().Length > 0)//模块为基本模块
            {
                if (userId == 0)
                {
                    return(0);
                }
                Camel.ApiModel.UserActionType result = Camel.ApiUserBLL.UserPowerExBLL.UserPowerExGet(companyId, userId, moduleId);
                if (userModule.RoleTypeId == 1)//当前为总管理用户
                {
                    return(0);
                }
                if (result == Camel.ApiModel.UserActionType.View)//仅能查看
                {
                    return(1);
                }
                else if (result == Camel.ApiModel.UserActionType.All)//可编辑
                {
                    return(0);
                }
                else
                {
                    return(-3);
                }
            }
            if (info == null)//无购买模块
            {
                return(-1);
            }
            if (info.ValidityDateEnd.CompareTo(DateTime.Now) > -1 && info.ValidityDateStart.CompareTo(DateTime.Now) < 1)
            {
                if (userId == 0)
                {
                    return(0);
                }
                if (userModule.RoleTypeId == 1)//当前为总管理用户
                {
                    return(0);
                }
                Camel.ApiModel.UserActionType result = Camel.ApiUserBLL.UserPowerExBLL.UserPowerExGet(companyId, userId, moduleId);
                if (result == Camel.ApiModel.UserActionType.View)//仅能查看
                {
                    return(1);
                }
                else if (result == Camel.ApiModel.UserActionType.All)//可编辑
                {
                    return(0);
                }
                else
                {
                    return(-3);
                }
            }
            else//模块过期
            {
                return(-2);
            }
        }
 public CompanyModule UpdateCompanyModule(CompanyModule companyModule)
 {
     return Channel.UpdateCompanyModule(companyModule);
 }