public IHttpActionResult Crowfounding(Crowfounding crow)
        {
            var    entity   = new EntityAccount();
            string response = entity.DataCrowfounding(crow.flag, crow.idUser, crow.idProd, crow.points, crow.help);

            return(Ok(response));
        }
        public IHttpActionResult ListProdProve(int prove)
        {
            var entity   = new EntityAccount();
            var dataList = new List <Provee>();

            dataList = entity.DataListProdProvee(prove);

            return(Ok(dataList));
        }
Ejemplo n.º 3
0
 public DataLite(IHttpContextAccessor context,
                 ILoggerFactory loggerFactory)
 {
     this.logger  = loggerFactory.CreateLogger("RequestInfoLogger");
     this.context = context.HttpContext;
     Initializing(this.context.Session.GetString("StorageName"));
     Accounts = new EntityAccount(Connection);
     Files    = new EntityFile(Connection);
 }
        public IHttpActionResult Login(Login dataLogin)
        {
            var entity = new EntityAccount();
            var data   = new ResponseLogin();

            if (dataLogin.plataforma.Equals("m"))
            {
                data = entity.DataLoginUser(dataLogin.usuario, dataLogin.contraseña);
            }
            else if (dataLogin.plataforma.Equals("w"))
            {
                data = entity.DataLoginProve(dataLogin.usuario, dataLogin.contraseña);
            }
            return(Ok(data));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 账号信息
        /// </summary>
        /// <param name="dtResult"></param>
        /// <returns></returns>
        public List <EntityAccount> GetAccount()
        {
            string SQL = string.Empty;
            List <EntityAccount> lstAccount = new List <EntityAccount>();
            SqlHelper            objSvc     = new SqlHelper(EnumBiz.onlineDB);

            try
            {
                SQL = @"select distinct a.oper_code   as empno,
                                        a.pwd,
                                        null          as signdigital,
                                        1             as acctstatus,
                                        d.funcid,
                                        d.funccode,
                                        d.funcname,
                                        d.functype,
                                        d.funcfile,
                                        d.opername,
                                        d.parentid,
                                        d.leafflag,
                                        d.sortno,
                                        d.imagesource
                          from code_operator a
                         inner join def_operator_role b
                            on a.oper_code = b.oper_code
                         inner join defrolefunction c
                            on b.role_code = c.rolecode
                         inner join sysfunction d
                            on c.funcid = d.funcid
                         where a.disable = 'F'
                           and d.functype in (0, 1, 3)
                         order by d.sortno";

                DataTable     dtResult = objSvc.GetDataTable(SQL);
                EntityAccount vo       = null;
                foreach (DataRow dr in dtResult.Rows)
                {
                    vo            = new EntityAccount();
                    vo.AcctStatus = Function.Int(dr["acctstatus"]);
                    //vo.EmpId = Function.Int(dr["empid"]);
                    vo.EmpNo = dr["empno"].ToString();
                    if (dr["pwd"] == DBNull.Value || string.IsNullOrEmpty(dr["pwd"].ToString()))
                    {
                        vo.Pwd = string.Empty;
                    }
                    else
                    {
                        vo.Pwd = dr["pwd"].ToString(); //ESCryptography.Decrypt(dr["pwd"].ToString());
                    }
                    vo.SignDigital = dr["signdigital"].ToString();
                    vo.FuncId      = Function.Int(dr["funcid"]);
                    vo.FuncCode    = dr["funccode"].ToString();
                    vo.FuncName    = dr["funcname"].ToString();
                    vo.FuncType    = Function.Int(dr["functype"]);
                    vo.FuncFile    = dr["funcfile"].ToString();
                    vo.OperName    = dr["opername"].ToString();
                    vo.ParentCode  = dr["parentid"].ToString();
                    vo.IsLeaf      = (dr["leafflag"] != DBNull.Value && dr["leafflag"].ToString() == "1" ? true : false);
                    vo.ImageSource = dr["imagesource"].ToString();
                    lstAccount.Add(vo);
                }
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
            }
            finally
            {
                objSvc = null;
            }
            return(lstAccount);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 反射入口
 /// </summary>
 /// <param name="vo"></param>
 public void ReflectionByAccVo(EntityAccount vo)
 {
     ((ctlFrame)Controller).LoadForm(vo);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// LoadForm
        /// </summary>
        /// <param name="vo"></param>
        internal void LoadForm(EntityAccount vo)
        {
            try
            {
                if (vo == null || string.IsNullOrEmpty(vo.FuncCode))
                {
                    return;
                }
                this.IsLoadform = true;
                string strPath   = Application.StartupPath + "\\" + vo.FuncFile.Trim();
                string className = vo.FuncCode.Trim();
                if (className.IndexOf("|") > 0)
                {
                    className = className.Substring(0, className.IndexOf("|"));
                }
                Assembly   objAsm  = Assembly.LoadFrom(strPath);
                object     obj     = objAsm.CreateInstance(className, true);
                Type       objType = obj.GetType();
                MethodInfo objMth;

                int n = 0;
                foreach (Form frm in Viewer.MdiChildren)
                {
                    if (frm is frmBaseMdi)
                    {
                        n++;
                    }
                }
                if (n >= 10)
                {
                    DialogBox.Msg("界面设定为最多打开10个,请关闭暂时不需要的界面。", MessageBoxIcon.Information);
                    return;
                }

                if (string.IsNullOrEmpty(vo.OperName))
                {
                    vo.OperName = "Show";
                }
                string   strMethod = vo.OperName;
                object[] objParams = null;
                int      intIndex  = strMethod.IndexOf("(");
                if (intIndex != -1) //带参
                {
                    string strParam = strMethod.Substring(intIndex + 1, strMethod.Length - intIndex - 2);
                    objParams = strParam.Split(',');
                    strMethod = strMethod.Substring(0, intIndex);
                    objMth    = objType.GetMethod(strMethod);
                }
                else
                {
                    objMth = objType.GetMethod(vo.OperName, new Type[0]);
                }
                if (objMth == null)
                {
                    DialogBox.Msg("自动创建模块失败。", MessageBoxIcon.Exclamation, Viewer);
                }
                if (obj is Form)
                {
                    if (!FormExisted(obj.GetType(), vo.OperName))
                    {
                        //if (vo.OperName.ToLower().Equals("show")) uiHelper.BeginLoading(Viewer);
                        if (vo.OperName.ToLower().Contains("show"))
                        {
                            uiHelper.BeginLoading(Viewer);
                        }
                        GetFormFuncButton(vo.FuncCode);
                        ((Form)obj).AccessibleName        = vo.FuncCode;
                        ((Form)obj).AccessibleDescription = vo.FuncName;
                        MakeMdiForm(obj, vo.OperName);
                        objMth.Invoke(obj, objParams);
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
                DialogBox.Msg(e.Message, MessageBoxIcon.Exclamation, Viewer);
            }
            finally
            {
                uiHelper.CloseLoading(Viewer);
                this.IsLoadform = false;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// SetFuncsBiz
        /// </summary>
        private void SetFuncsBiz()
        {
            // 默认:暂时只用2级菜单
            List <EntityAccount> lst1 = new List <EntityAccount>();
            Dictionary <string, List <EntityAccount> > lst2 = new Dictionary <string, List <EntityAccount> >();

            foreach (EntityAccount item in GlobalAppConfig.AccountFuncs)
            {
                if (item.IsLeaf == false)
                {
                    lst1.Add(item);
                }
            }
            foreach (EntityAccount item in GlobalAppConfig.AccountFuncs)
            {
                if (item.IsLeaf && lst1.Exists(t => t.FuncId.ToString() == item.ParentCode))
                {
                    if (lst2.ContainsKey(item.ParentCode))
                    {
                        lst2[item.ParentCode].Add(item);
                    }
                    else
                    {
                        List <EntityAccount> tmp = new List <EntityAccount>();
                        tmp.Add(item);
                        lst2.Add(item.ParentCode, tmp);
                    }
                }
            }
            int i1 = 0;
            int i2 = 0;

            DevExpress.XtraBars.BarButtonItem barItem    = null;
            DevExpress.XtraBars.BarSubItem    barSubItem = null;
            foreach (EntityAccount item in lst1)
            {
                barSubItem = new DevExpress.XtraBars.BarSubItem();
                barSubItem.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                barSubItem.Name            = item.FuncCode;
                barSubItem.Caption         = Convert.ToString(++i1) + ". " + item.FuncName;
                if (!string.IsNullOrEmpty(item.ImageSource))
                {
                    barSubItem.Glyph = (rm.GetObject(item.ImageSource) as Image);
                }
                Viewer.pmModules.ItemLinks.Add(barSubItem, true);
                if (lst2.ContainsKey(item.FuncId.ToString()))
                {
                    i2 = 0;
                    foreach (EntityAccount item2 in lst2[item.FuncId.ToString()])
                    {
                        barItem = new DevExpress.XtraBars.BarButtonItem();
                        barItem.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                        barItem.Name            = item2.FuncCode;
                        barItem.Caption         = i1.ToString() + "." + Convert.ToString(++i2) + " " + item2.FuncName;
                        barItem.Tag             = item2;
                        barItem.ItemClick      += new ItemClickEventHandler(bbiItem_ItemClick);
                        if (!string.IsNullOrEmpty(item2.ImageSource))
                        {
                            barItem.Glyph = (rm.GetObject(item2.ImageSource) as Image);
                        }
                        barSubItem.ItemLinks.Add(barItem, true);
                        if (GlobalParm.dicSysMenu.ContainsKey(item2.FuncName) == false)
                        {
                            GlobalParm.dicSysMenu.Add(item2.FuncName, item2);
                        }
                    }
                }
            }

            DefaultModule = new EntityAccount()
            {
                FuncId = 88888888, FuncCode = "Hms.Ui.frmAccess", FuncName = "导航图...", FuncFile = "hms.ui.dll", OperName = "Show"
            };
            Viewer.timer.Enabled = true;
        }
Ejemplo n.º 9
0
        public IHttpActionResult InsertAccountData(VMAccount model)
        {
            if (!IsRep && (model.RepId == null || model.RepId <= 0))
            {
                List <dynamic> errorList = new List <dynamic>();

                if (!HasRight(new string[] { "RDREPGRPALL" }))
                {
                    errorList.Add(new { Message = "You do not have right to read repgroup" });
                }

                if (!HasRight(new string[] { "WRREP" }))
                {
                    errorList.Add(new { Message = "You do not have right to create rep" });
                }

                if (errorList != null && errorList.Count <= 0)
                {
                    errorList.Add(new { Message = "RepGroup and Rep are required" });
                }

                return(Ok <dynamic>(new { Status = HttpStatusCode.PreconditionFailed, ResponseMessage = errorList }));
            }

            var repository = new RepositoryAccount();
            var response   = new DataResponse();

            if (ModelState.IsValid)
            {
                var entityAccount = new EntityAccount
                {
                    EnrolledDate       = model.EnrolledDate,
                    IsActive           = model.IsActive,
                    LeadSourceId       = model.LeadSourceId,
                    LeadServiceIntrest = model.ServiceInterest,
                    RepGroupId         = model.RepGroupId,
                    RepId       = model.RepId,
                    IsConverted = true,
                    ServiceIds  = model.EnrolledServices
                };
                entityAccount.Practice = new EntityPractice
                {
                    //Fax = model.Fax,
                    ReportDeliveryEmail = model.ReportDeliveryEmail,
                    ReportDeliveryFax   = model.ReportDeliveryFax,
                    Name                = model.PracticeName,
                    SpecialityTypeId    = model.SpecialityTypeId,
                    ContactPreferenceId = model.MethodOfContact,
                    Address             = new List <EntityPracticeAddress>
                    {
                        new EntityPracticeAddress {
                            Id            = model.AddressId ?? 0,
                            AddressIndex  = -1,
                            City          = model.City,
                            Line1         = model.PracticeAddressLine1,
                            Line2         = model.PracticeAddressLine2,
                            AddressTypeId = 1,
                            StateId       = model.StateId ?? 0,
                            Zip           = model.Zip,
                            Fax           = model.Fax,
                            Phone         = new List <EntityPracticePhone> {
                                new EntityPracticePhone {
                                    PhoneNumber = model.PhoneNumber,
                                    Extension   = model.PhoneExtension
                                }
                            },
                            AddressId           = model.AddressId ?? 0,
                            ManagerName         = model.ManagerName,
                            ManagerEmail        = model.ManagerEmail,
                            ManagerPhone        = model.ManagerPhone,
                            BillingContact      = model.BillingContact,
                            BillingContactEmail = model.BillingContactEmail,
                            BillingContactPhone = model.BillingContactPhone,
                            officedayshrs       = model.WorkingHours,
                        }
                    },
                    Contact = new List <EntityPracticeContact>
                    {
                        new EntityPracticeContact
                        {
                            BillingContact      = model.BillingContact,
                            BillingContactEmail = model.BillingContactEmail,
                            BillingContactPhone = model.BillingContactPhone,
                            ManagerName         = model.ManagerName,
                            ManagerPhone        = model.ManagerPhone,
                            ManagerEmail        = model.ManagerEmail,
                            officedayshrs       = model.WorkingHours,
                            AddressId           = model.AddressId ?? 0
                        }
                    }
                };

                var specialities = new List <EntityPracticeSpeciality>();

                entityAccount.Practice.Specialities = new List <EntityPracticeSpeciality>();
                entityAccount.PracticeTypeId        = model.SpecialityTypeId == 0 ? null : model.SpecialityTypeId;
                if (model.SpecialityTypeId == 1)
                {
                    specialities.Add(new EntityPracticeSpeciality {
                        PracticeSpecialityId = model.SpecialityId ?? 0
                    });
                }
                else if (model.SpecialityTypeId == 2 && model.SpecialityIds != null && model.SpecialityIds.Count() > 0)
                {
                    foreach (string sId in model.SpecialityIds)
                    {
                        specialities.Add(new EntityPracticeSpeciality {
                            PracticeSpecialityId = int.Parse(sId)
                        });
                    }
                }
                else if (model.SpecialityTypeId == 3 && !string.IsNullOrEmpty(model.NewSpectialityName))
                {
                    entityAccount.Practice.SpecialityType = model.NewSpectialityName;
                }

                if (specialities.Count > 0)
                {
                    entityAccount.Practice.Specialities = specialities;
                }

                if (model.Locations != null)
                {
                    var addressList = new List <EntityPracticeAddress>();
                    var contactList = new List <EntityPracticeContact>();
                    model.Locations.ToList().ForEach(a => addressList.Add(new EntityPracticeAddress
                    {
                        Id            = a.AddressId ?? 0,
                        AddressIndex  = a.AddressIndex.Value,
                        Line1         = a.AddressLine1,
                        Line2         = a.AddressLine2,
                        City          = a.City,
                        AddressTypeId = 2,
                        StateId       = a.StateId ?? 0,
                        Zip           = a.Zip,
                        Fax           = a.Fax,
                        Phone         = new List <EntityPracticePhone> {
                            new EntityPracticePhone {
                                PhoneNumber = a.PhoneNumber,
                                Extension   = a.Extension
                            }
                        },
                        AddressId           = a.AddressId ?? 0,
                        ManagerName         = a.ManagerName,
                        ManagerEmail        = a.ManagerEmail,
                        ManagerPhone        = a.ManagerPhone,
                        BillingContact      = a.BillingContact,
                        BillingContactEmail = a.BillingContactEmail,
                        BillingContactPhone = a.BillingContactPhone,
                        officedayshrs       = a.WorkingHours,
                    }));

                    if (addressList.Count > 0)
                    {
                        entityAccount.Practice.Address = entityAccount.Practice.Address.Concat(addressList);
                    }

                    entityAccount.Practice.Address.ToList().ForEach(a => contactList.Add(new EntityPracticeContact
                    {
                        AddressId           = a.AddressId,
                        ManagerName         = a.ManagerName,
                        ManagerEmail        = a.ManagerEmail,
                        ManagerPhone        = a.ManagerPhone,
                        BillingContact      = a.BillingContact,
                        BillingContactEmail = a.BillingContactEmail,
                        BillingContactPhone = a.BillingContactPhone,
                        officedayshrs       = a.officedayshrs,
                    }));

                    if (contactList.Count > 0)
                    {
                        entityAccount.Practice.Contact = contactList;
                    }
                }
                if (model.Providers != null)
                {
                    var isMultipleProviders = model.Providers.GroupBy(a => a.NPI).Any(a => a.Count() > 1);
                    if (isMultipleProviders)
                    {
                        return(Ok <dynamic>(new { Status = HttpStatusCode.BadRequest, Model = new { Key = "NPI", Message = "NPI is Repeating" } }));
                    }

                    var providerList = new List <EntityProvider>();
                    model.Providers.ForEach(a =>
                                            providerList.Add(
                                                new EntityProvider
                    {
                        Id           = a.Id ?? 0,
                        DegreeId     = a.DegreeId ?? 0,
                        FirstName    = a.FirstName,
                        LastName     = a.LastName,
                        MiddleName   = a.MiddleName,
                        NPI          = a.NPI,
                        AddressIndex = a.Location != null ? (a.Location.AddressIndex == null ? -1 : a.Location.AddressIndex.Value) : -1,
                        Address      = a.Location != null ? new EntityProviderAddress
                        {
                            Id            = a.Location.AddressId == null ? 0 : a.Location.AddressId.Value,
                            City          = a.Location.City,
                            Line1         = a.Location.AddressLine1,
                            Line2         = a.Location.AddressLine2,
                            AddressTypeId = 2,
                            StateId       = a.Location.StateId.Value,
                            Zip           = a.Location.Zip,
                            Fax           = a.Location.Fax,
                            ManagerName   = a.Location.ManagerName,
                            Phone         = a.Location == null ? null : new List <EntityPracticePhone> {
                                new EntityPracticePhone {
                                    PhoneNumber = a.Location.PhoneNumber,
                                    Extension   = a.Location.Extension
                                }
                            }
                        } : null
                    }));

                    if (providerList.Count > 0)
                    {
                        entityAccount.Practice.Providers = providerList;
                    }
                }
                entityAccount.UpdatedBy     = entityAccount.CreatedBy = entityAccount.CurrentUserId = CurrentUser.Id;
                entityAccount.BusinessId    = CurrentUser.BusinessId;
                entityAccount.CreatedByName = string.Format("{0} {1}", CurrentUser.FirstName, CurrentUser.LastName);

                if (model.Id > 0) //Update
                {
                    entityAccount.Id = model.Id ?? 0;
                    response         = repository.Update(entityAccount);
                }
                else
                {
                    if (model.LeadId > 0) //Converted from Lead
                    {
                        entityAccount.LeadId = model.LeadId;
                        response             = repository.ConvertToAccount(entityAccount);
                    }
                    else //New account
                    {
                        response = repository.Insert(entityAccount);
                    }

                    if (response.Id != null)
                    {
                        string services = string.Empty, providers = string.Empty, practiceAddress = string.Empty;

                        if (entityAccount.ServiceIds != null)
                        {
                            var ids = ((IEnumerable <string>)entityAccount.ServiceIds).Select(a => Convert.ToInt32(a)).ToArray();
                            services = string.Join(", ", new RepositoryLookups().GetServicesById(ids));
                        }

                        foreach (var item in entityAccount.Practice.Providers)
                        {
                            providers = providers + item.FirstName + " " + item.LastName + " (" + item.NPI + ") <br />";
                        }

                        var primaryAddress = entityAccount.Practice.Address.First();

                        var stateName = new RepositoryLookups().GetAllStates().Model.List.Where(a => a.Id == primaryAddress.StateId).First().Value;
                        practiceAddress = string.Format("{0}, {1}, {2}, {3}, {4}", primaryAddress.Line1, primaryAddress.Line2, primaryAddress.City, stateName, primaryAddress.Zip);

                        EntityGroupManagerDetails RepModel = repository.RepDetailsByAccountId(response.Id).Model;

                        EmailNotification emailNotify = new EmailNotification
                        {
                            PracticeName         = model.PracticeName,
                            PracticeAddress      = practiceAddress,
                            Providers            = providers,
                            Services             = services,
                            RepFirstName         = RepModel.RepFirstName,
                            RepMiddleName        = RepModel.RepMiddleName,
                            RepLastName          = RepModel.RepLastName,
                            RepEmail             = RepModel.RepEmail,
                            Managers             = RepModel.Managers,
                            CurrentUserFirstName = CurrentUser.FirstName,
                            CurrentUserLastName  = CurrentUser.LastName,
                            RootPath             = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath,
                            ReturnUrl            = ConfigurationManager.AppSettings["BaseUrl"],
                        };
                        NewAccountEmailNotification(emailNotify);
                    }
                }
            }
            else
            {
                var errorList = ModelState.Where(a => a.Value.Errors.Any()).Select(s => new
                {
                    Key     = s.Key.Split('.').Last(),
                    Message = s.Value.Errors[0].ErrorMessage
                });
                return(Ok <dynamic>(new { Status = HttpStatusCode.BadRequest, Model = errorList }));
            }
            return(Ok <DataResponse>(response));
        }