Exemplo n.º 1
0
        private static Dictionary <string, Type> GetTypes(Assembly assembly, EnumRegisterType registerType)
        {
            var types = new Dictionary <string, Type>();

            foreach (Type t in assembly.GetTypes())
            {
                if (registerType == EnumRegisterType.FromType)
                {
                    if (t.IsInterface)
                    {
                        if (!types.ContainsKey(t.FullName))
                        {
                            types.Add(t.FullName, t);
                        }
                    }
                }
                else if (registerType == EnumRegisterType.ToType)
                {
                    if (!t.IsInterface)
                    {
                        if (!types.ContainsKey(t.FullName))
                        {
                            types.Add(t.FullName, t);
                        }
                    }
                }
                else
                {
                }
            }

            return(types);
        }
        private static Dictionary<string, Type> GetTypes(Assembly assembly, EnumRegisterType registerType)
        {
            var types = new Dictionary<string, Type>();

            foreach (Type t in assembly.GetTypes())
            {
                if (registerType == EnumRegisterType.FromType)
                {
                    if (t.IsInterface)
                    {
                        if (!types.ContainsKey(t.FullName))
                        {
                            types.Add(t.FullName, t);
                        }
                    }
                }
                else if (registerType == EnumRegisterType.ToType)
                {
                    if (!t.IsInterface)
                    {
                        if (!types.ContainsKey(t.FullName))
                        {
                            types.Add(t.FullName, t);
                        }
                    }
                }
                else 
                {                   
                }
            }

            return types;
        }
Exemplo n.º 3
0
        public static string InsertClient(EnumRegisterType registerType, EnumAccountType accountType, string account, string loginPwd, string clientName, string contactName, string mobile, string email, string industry, string citycode, string address, string remark,
                                          string companyid, string operateid, out int result, out string userid)
        {
            loginPwd = CloudSalesTool.Encrypt.GetEncryptPwd(loginPwd, account);

            string clientid = ClientDAL.BaseProvider.InsertClient((int)registerType, (int)accountType, account, loginPwd, clientName, contactName, mobile, email, industry, citycode, address, remark, companyid, operateid, out result, out userid);

            return(clientid);
        }
Exemplo n.º 4
0
        public static _RegisterValue getRegisterValueFactory(EnumRegisterType registerType, int address, string name)
        {
            _RegisterValue registerValue = null;

            switch (registerType)
            {
            case EnumRegisterType.DiscreteInput:
            case EnumRegisterType.DiscreteOutput:
                registerValue = new RegisterValue <bool>()
                {
                    Address = address,
                    Name    = name,
                    Value   = false
                };
                break;

            case EnumRegisterType.AnalogInput:
            case EnumRegisterType.AnalogOutput:
                registerValue = new RegisterValue <short>()
                {
                    Address = address,
                    Name    = name,
                    Value   = 0
                };
                break;

            case EnumRegisterType.FloatInput:
            case EnumRegisterType.FloatOutput:
                registerValue = new RegisterValue <float>()
                {
                    Address = address,
                    Name    = name,
                    Value   = 0f
                };
                break;

            case EnumRegisterType.LongInput:
            case EnumRegisterType.LongOutput:
                registerValue = new RegisterValue <int>()
                {
                    Address = address,
                    Name    = name,
                    Value   = 0
                };
                break;
            }

            return(registerValue);
        }
Exemplo n.º 5
0
        public static List <Clients> GetClients(string keyWords, EnumRegisterType type, string orderBy, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            string sqlWhere = "Status<>9";

            if (!string.IsNullOrEmpty(keyWords))
            {
                sqlWhere += " and ( MobilePhone = '" + keyWords + "' or  ClientCode = '" + keyWords + "' ";
                if (keyWords.Length > 3)
                {
                    sqlWhere += " or CompanyName like '%" + keyWords + "%'  ";
                }
                sqlWhere += ")";
            }
            if ((int)type > -1)
            {
                sqlWhere += " and RegisterType=  " + (int)type;
            }
            string sqlColumn = @" * ";
            bool   isAsc     = false;

            if (string.IsNullOrEmpty(orderBy))
            {
                orderBy = "AutoID";
            }
            else
            {
                isAsc   = orderBy.IndexOf(" asc") > -1 ? true : false;
                orderBy = orderBy.Replace(" desc", "").Replace(" asc", "");
            }
            DataTable      dt   = CommonBusiness.GetPagerData("Clients", sqlColumn, sqlWhere, orderBy, pageSize, pageIndex, out totalCount, out pageCount, isAsc);
            List <Clients> list = new List <Clients>();
            Clients        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new Clients();
                model.FillData(item);

                model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault();
                // model.IndustryEntity =Manage.IndustryBusiness.GetIndustrys().Where(i => i.IndustryID.ToLower() == model.Industry.ToLower()).FirstOrDefault();
                list.Add(model);
            }

            return(list);
        }