Exemplo n.º 1
0
        public void LoadLocalData()
        {
            if (this.InvokeRequired)
            {
                LoadDelegate ld = new LoadDelegate(LoadLocalData);
                this.Invoke(ld);
            }
            else
            {
                CustomerServer.GetCustomerAndRegion(ref _ht_Sender, ref _ht_Receiv, ref _ht_Region);
                FrmParent.ParentForm._AllRegion = RegionServer.GetAllRegion();

                _storage_Scan = StorageServer.GetAllStorageScan();

                _UCSenderInfo         = new UCCustomerInfo(true);
                _UCRecevInfo          = new UCCustomerInfo(false);
                _UCSenderInfo.Parent  = this;
                _UCRecevInfo.Parent   = this;
                _UCSenderInfo.Dock    = DockStyle.None;
                _UCRecevInfo.Dock     = DockStyle.None;
                _UCSenderInfo.Visible = false;
                _UCRecevInfo.Visible  = false;
                _UCSenderInfo.Load();
                _UCRecevInfo.Load();
            }
        }
        public ActionResult SaveServer(CustomerServer server)
        {
            var servers = _context.CustomerServers.Where(s => s.CustomerId == server.CustomerId);

            var serverViewModel = new ServerViewModel
            {
                Servers    = servers,
                CustomerId = server.CustomerId
            };

            if (server.Id == 0)
            {
                _context.CustomerServers.Add(server);
                _context.SaveChanges();
                return(View("_ServerInfo", serverViewModel));
            }

            var customer = _context.Customers.Single(c => c.Id == server.CustomerId);

            var serverInDb = _context.CustomerServers.SingleOrDefault(s => s.Id == server.Id);

            serverInDb.ServerName       = server.ServerName;
            serverInDb.PublicIpAddress  = server.PublicIpAddress;
            serverInDb.PrivateIpAddress = server.PrivateIpAddress;
            serverInDb.Port             = server.Port;
            serverInDb.UserName         = server.UserName;
            serverInDb.Password         = server.Password;

            _context.SaveChanges();
            return(View("_ServerInfo", serverViewModel));
        }
Exemplo n.º 3
0
 /// <summary>
 /// 窗体加载时 初始化时钟 并且 打开菜单窗体
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmParent_Load(object sender, EventArgs e)
 {
     if (!Init())
     {
         Application.Exit();
         return;
     }
     LoadLocalData();
     //tmTime_Tick(sender, e);
     tmUpload.Interval = 3000;
     //if (! UCNodeScan._IsCameraActive)
     //    UCNodeScan._IsCameraActive = UnitechDSDll.OpenCamera(pbPreview.Handle, 3, 3, 400, 300, 1024, 768);
     OpenForm(PageState.Main);
     CheckInputPnl(false);
     CustomerServer.AddCustomersCountyId();
     HuadongTmsOrderServer.AddTMSOrderOptAt();
     BaseServer.AddTable_c2lp_optRecord();
     BaseServer.AddTable_c2lp_consignor();
     BaseServer.AddTable_c2lp_storage_scan();
     BaseServer.AddNode_ParentStorageId();
     BaseServer.AddLinkType();
     BaseServer.AddLinkRegex();
     BaseServer.AddConsignorId();
     BaseServer.AddColunmForScanRecord();
     BaseServer.AddColunmForScanRecord1();
     BaseServer.AddColunmForScanRecord2();
 }
Exemplo n.º 4
0
 /// <summary>
 /// 窗体加载时 初始化时钟 并且 打开菜单窗体
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmParent_Load(object sender, EventArgs e)
 {
     //tmTime_Tick(sender, e);
     tmUpload.Interval = 3000;
     if (!UCNodeScan._IsCameraActive)
     {
         UCNodeScan._IsCameraActive = UnitechDSDll.OpenCamera(pbPreview.Handle, 3, 3, 400, 300, 1024, 768);
     }
     OpenForm(PageState.Main);
     CheckInputPnl(false);
     CustomerServer.AddCustomersCountyId();
     HuadongTmsOrderServer.AddTMSOrderOptAt();
 }
Exemplo n.º 5
0
        /// <summary>
        /// 根据区域显示下游客户
        /// </summary>
        /// <param name="zoneOption">区域id</param>
        /// <returns></returns>
        public ResultModel <List <Model_Customer> > GetDownstreamQZList(string zoneOption = null)
        {
            ResultModel <List <Model_Customer> > result = new ResultModel <List <Model_Customer> >();

            try
            {
                result.Data = CustomerServer.CustomerDownstreamQZ(zoneOption);
            }
            catch (Exception ex)
            {
                result.Code    = 1;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 新增或更新客户信息
        /// </summary>
        /// <param name="customerInfo">客户信息</param>
        /// <param name="bindReceiverOrg">与第三方运单收货单位关联的名称</param>
        /// <returns></returns>
        public ResultModel <bool> UpdateCustomer(Model_Customer customerInfo, string bindReceiverOrg)
        {
            ResultModel <bool> result = new ResultModel <bool>();

            try
            {
                result.Data = CustomerServer.UpdateCustomer(customerInfo, bindReceiverOrg);
            }
            catch (Exception ex)
            {
                result.Code    = 1;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        ///  新增和修改客户信息更新时间
        /// </summary>
        /// <param name="customerInfo"></param>
        /// <returns></returns>
        public ResultModel <Model_Customer> GetCustomerUpdateTime(Model_Customer customerInfo)
        {
            ResultModel <Model_Customer> result = new ResultModel <Model_Customer>();

            try
            {
                result.Data = CustomerServer.GetCustomerUpdateTime(customerInfo);
            }
            catch (Exception ex)
            {
                result.Code    = 1;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 根据省市县或是客户名称查询收货单位总数
        /// </summary>
        /// <param name="customer"></param>
        /// <returns></returns>
        public ResultModel <int> GetConsigneeCountyCount(Model_Customer customer)
        {
            ResultModel <int> result = new ResultModel <int>();

            try
            {
                result.Data = CustomerServer.GetConsigneeCountyCount(customer);
            }
            catch (Exception ex)
            {
                result.Code    = 1;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 根据省市县或是客户名称查询收货单位
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="pageIndexAndCount"></param>
        /// <returns></returns>
        public ResultModel <List <Model_Customer> > GetConsigneeCounty(Model_Customer customer, string pageIndexAndCount = null)
        {
            ResultModel <List <Model_Customer> > result = new ResultModel <List <Model_Customer> >();

            try
            {
                result.Data = CustomerServer.GetConsigneeCounty(customer, pageIndexAndCount);
            }
            catch (Exception ex)
            {
                result.Code    = 1;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 根据客户角色获取客户列表
        /// </summary>
        /// <param name="role">客户角色</param>
        /// <param name="provinceId">可选参数[所在省份 region Id,为0时默认查询所有省份]</param>
        /// <param name="cityId">可选参数[所在省份 region Id,为0时默认查询所有城市]</param>
        /// <param name="pageIndexAndCount">可选参数[分页参数,无需分页则不填,格式为"页索引.每页数量".例如:1.50,表示每页显示50条,当前查询第1页]</param>
        /// <returns></returns>
        public ResultModel <List <Model_Customer> > GetCustomerListByRole(Enum_Role role, int provinceId = 0, int cityId = 0, string pageIndexAndCount = null)
        {
            ResultModel <List <Model_Customer> > result = new ResultModel <List <Model_Customer> >();

            try
            {
                result.Data = CustomerServer.GetCustomerListByRoles(role, provinceId, cityId, pageIndexAndCount);
            }
            catch (Exception ex)
            {
                result.Code    = 1;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 登录验证
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        public ResultModel <Model_Customer> Login(string userName, string password)
        {
            ResultModel <Model_Customer> result = new ResultModel <Model_Customer>();

            try
            {
                result.Data = CustomerServer.CheckCustomerUser(userName, password);
            }
            catch (Exception ex)
            {
                result.Code    = 1;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 编辑客户信息
        /// </summary>
        /// <param name="customerInfo">客户信息</param>
        /// <returns></returns>
        public ResultModel <Model_Customer> EditCustomer(Model_Customer customerInfo)
        {
            ResultModel <Model_Customer> result = new ResultModel <Model_Customer>();

            try
            {
                result.Data = CustomerServer.CustomerNew(customerInfo);
            }
            catch (Exception ex)
            {
                result.Code    = 1;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 查询客户信息总数
        /// </summary>
        /// <param name="role">客户角色</param>
        /// <param name="provinceId">可选参数[所在省份 region Id,为0时默认查询所有省份]</param>
        /// <param name="cityId">可选参数[所在省份 region Id,为0时默认查询所有城市]</param>
        /// <returns></returns>
        public ResultModel <int> GetCustomerListByRoleCount(Enum_Role role, int provinceId = 0, int cityId = 0)
        {
            ResultModel <int> result = new ResultModel <int>();

            try
            {
                result.Data = CustomerServer.GetCustomerListByRoleCount(role, provinceId, cityId);
            }
            catch (Exception ex)
            {
                result.Code    = 1;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 14
0
 private void LoadCustomer()
 {
     try
     {
         _AllCustomer = CustomerServer.GetAllCustomer(null);
         if (_AllCustomer.Count == 0)
         {
             throw new Exception("设备中没有任何客户信息,请联系后台添加后重新同步信息!");
         }
     }
     catch (Exception ex)
     {
         throw new Exception("加载客户信息失败:" + ex.Message);
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// 窗体加载时 初始化时钟 并且 打开菜单窗体
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmParent_Load(object sender, EventArgs e)
 {
     //tmTime_Tick(sender, e);
     tmUpload.Interval = 3000;
     //if (!UCNodeScan._IsCameraActive)
     //    UCNodeScan._IsCameraActive = UnitechDSDll.OpenCamera(pbPreview.Handle, 3, 3, 400, 300, 1024, 768);
     OpenForm(PageState.Main);
     CheckInputPnl(false);
     CustomerServer.AddCustomersCountyId();
     //CustomerServer.GetCustomerAndRegion(ref _ht_Sender, ref _ht_Receiv, ref _ht_Region);
     //UCSenderInfo.Load();
     //UCRecevInfo.Load();
     //UCSenderInfo.Visible = true;
     //UCRecevInfo.Visible = true;
 }
Exemplo n.º 16
0
        /// <summary>
        /// 拼接客户数据字符串
        /// </summary>
        /// <param name="storages">客户数据数组</param>
        /// <returns></returns>
        private static void GetCustomersStr(PDA_Model_Customer[] customers, out string insertSql, out string updateSql)
        {
            insertSql = string.Empty;
            StringBuilder valueSql       = new StringBuilder("insert into c2lp_customer (Id,fullName,contactPerson,contactTel,contactAddress,provinceId,cityId,role,countyId) values ");
            StringBuilder updateValueSql = new StringBuilder();
            string        updateModelSql = "update c2lp_customer set fullName = '{0}',contactPerson='{1}',contactTel='{2}',contactAddress='{3}',provinceId='{4}',cityId='{5}',role='{6}',countyId='{7}' where id = '{8}';";
            bool          hasInsert      = false;

            if (customers != null && customers.Length > 0)
            {
                //所有客户的ID
                List <string> cIdList          = customers.ToList().Select(l => l.idk__BackingField.ToString()).ToList();
                List <int>    needUpdateIdList = CustomerServer.GetUpdateCustomerIdList(cIdList);
                foreach (PDA_Model_Customer c in customers)
                {
                    int role = 1;
                    if (c.rolek__BackingField == 2)
                    {
                        role = 2;
                    }
                    else if (c.rolek__BackingField == 3)
                    {
                        role = 3;
                    }
                    if (needUpdateIdList.Contains(c.idk__BackingField))
                    {
                        updateValueSql.AppendLine(string.Format(updateModelSql, c.fullNamek__BackingField, c.contactPersonk__BackingField,
                                                                c.contactTelk__BackingField, c.contactAddressk__BackingField, c.provinceIdk__BackingField, c.cityIdk__BackingField, role, c.countyIdk__BackingField, c.idk__BackingField));
                    }
                    else
                    {
                        valueSql.AppendFormat("('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}'),", c.idk__BackingField, c.fullNamek__BackingField, c.contactPersonk__BackingField,
                                              c.contactTelk__BackingField, c.contactAddressk__BackingField, c.provinceIdk__BackingField, c.cityIdk__BackingField, role, c.countyIdk__BackingField);
                        hasInsert = true;
                    }
                }
                valueSql.Length -= 1;
                valueSql.Append(";");
            }
            if (hasInsert)
            {
                insertSql = valueSql.ToString();
            }
            updateSql = updateValueSql.ToString();
        }
Exemplo n.º 17
0
        /// <summary>
        /// 更新客户信息
        /// </summary>
        /// <param name="result">客户信息数据</param>
        private static void UpdateCustomer(int pid, int maxId, int currCount)
        {
            //if (maxId == 0)
            //{
            //    CustomerServer.ClearCustomers();
            //    RegistSyncEvent("已清空原有客户信息...");
            //}
            //ResultModelOfArrayOfModel_Customerd4FqxSXX result = Common._PdaServer.GetCustomersFromMaxId(pid, true, maxId, true);
            ResultModelOfArrayOfPDA_Model_Customerd4FqxSXX result = Common._PdaServer.GetNewCustomers(pid, true, DateTime.Parse(Common._LastSyncTime), true, maxId, true);

            if (result.Code != 0)
            {
                throw new Exception(result.Message);
            }
            try
            {
                if (result.Data.Length == 0)
                {
                    RegistSyncEvent("已经没有需要更新的客户信息了.");
                    return;
                }
                string insertSql = string.Empty;
                string updateSql = string.Empty;
                GetCustomersStr(result.Data, out insertSql, out updateSql);
                CustomerServer.UpdateCustomers(ref insertSql, ref updateSql);
                string info = "新增客户{0}条,更新客户{1}条,当前第{2}批";
                RegistSyncEvent(string.Format(info, insertSql, updateSql, currCount + 1));
                _isReLoadLocalInfo += int.Parse(insertSql) + int.Parse(updateSql);
                if (result.Data.Count() != 0)
                {
                    Thread.Sleep(500);//递归分页获取
                    currCount += 1;
                    UpdateCustomer(pid, result.Data.Last().idk__BackingField, currCount);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("更新客户信息失败:" + ex.Message);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 更新客户信息
        /// </summary>
        /// <param name="result">客户信息数据</param>
        private static void UpdateCustomer(int pid, int maxId, int currCount)
        {
            if (maxId == 0)
            {
                CustomerServer.ClearCustomers();
                RegistSyncEvent("已清空原有客户信息...");
            }
            ResultModelOfArrayOfModel_Customerd4FqxSXX result = Common._PdaServer.GetCustomersFromMaxId(pid, true, maxId, true);

            if (result.Code != 0)
            {
                throw new Exception(result.Message);
            }
            try
            {
                if (result.Data.Length == 0)
                {
                    RegistSyncEvent("已经没有客户信息了.");
                    return;
                }
                string valueStr = GetCustomersStr(result.Data);
                int    count    = CustomerServer.UpdateCustomers(valueStr);
                string info     = "新增客户{0}条,当前第{1}批";
                RegistSyncEvent(string.Format(info, result.Data.Count().ToString(), currCount + 1));

                if (result.Data.Count() != 0)
                {
                    Thread.Sleep(500);//递归分页获取
                    currCount += 1;
                    UpdateCustomer(pid, result.Data.Last().Idk__BackingField, currCount);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("更新客户信息失败:" + ex.Message);
            }
        }