예제 #1
0
        /// <summary>
        /// 创建网点客户管理关系
        /// </summary>
        /// <param name="serviceSpaceId">服务空间id</param>
        /// <param name="serviceNetworkId">服务网点id</param>
        /// <param name="customerId">客户id</param>
        /// <returns></returns>
        public bool CreateNetworkCustomer(string serviceSpaceId, string serviceNetworkId, string customerId)
        {
            //参数验证
            if (string.IsNullOrEmpty(customerId) || string.IsNullOrEmpty(serviceSpaceId) || string.IsNullOrEmpty(serviceNetworkId))
            {
                return(false);
            }

            DataEntity networkCusEntity = new DataEntity();

            networkCusEntity.Add("ServiceSpaceID", serviceSpaceId);
            networkCusEntity.Add("ServiceNetworkID", serviceNetworkId);
            networkCusEntity.Add("CustomerID", customerId);

            return(_customerProvider.AddNetworkCustomer(networkCusEntity));
        }
예제 #2
0
        /// <summary>
        /// 保存客户标签
        /// </summary>
        /// <param name="customerLabel">客户标签</param>
        /// <returns></returns>
        public bool SaveCustomerLabel(CustomerLabel customerLabel)
        {
            if (customerLabel == null || string.IsNullOrEmpty(customerLabel.ServiceSpaceID))
            {
                return(false);
            }

            DataEntity labelDataEntity = new DataEntity();

            labelDataEntity.Add("ID", string.IsNullOrEmpty(customerLabel.ID) ? "" : customerLabel.ID);
            labelDataEntity.Add("Name", string.IsNullOrEmpty(customerLabel.Name) ? "" : customerLabel.Name);
            labelDataEntity.Add("ServiceSpaceId", string.IsNullOrEmpty(customerLabel.ServiceSpaceID) ? "" : customerLabel.ServiceSpaceID);
            bool isSuccessed = _customerProvider.SaveCustomerLabel(labelDataEntity);

            return(isSuccessed);
        }
예제 #3
0
        public async Task <Device> DeviceAdd(Device Device)
        {
            if (Device.ConsumerId == null && Device.Consumer == null)
            {
                throw new EntityNotFoundException("Consumer id not provided while adding a device", Device);
            }

            if (Device.ConsumerId != null)
            {
                var consumer = ConsumerGet(Device.ConsumerId);
                if (consumer == null)
                {
                    throw new EntityNotFoundException("Could not add the device, consumer id does not exist.", Device);
                }
            }
            else
            {
                var consumer = ConsumerGet(Device.Consumer.ConsumerId);
                if (consumer == null)
                {
                    throw new EntityNotFoundException($"Could not add the device, consumer id {Device.Consumer.ConsumerId} does not exist.", Device);
                }
            }

            var result = await _deviceDataEntity.Add(Device);

            Log.Debug($"Device added - { Serializer.Serialize(result)}");
            return(result);
        }
예제 #4
0
        public async Task <Consumer> ConsumerAdd(Consumer Consumer)
        {
            var result = await _consumerDataEntity.Add(Consumer);

            Log.Debug($"Consumer added - {Serializer.Serialize(result)}");
            return(result);
        }
예제 #5
0
        /// <summary>
        /// 获取客户标签
        /// </summary>
        /// <param name="id">标签id</param>
        /// <returns></returns>
        public DataEntity GetCustomerLabel(string id)
        {
            DataEntity customerLabel = null;
            DBHelper   dbHelper      = new DBHelper(ConnectionString, DbProviderType.SqlServer);

            string strSql = @"SELECT  [ID],[ServiceSpaceId],[Name] FROM [CustomerLabel] Where ID='" + id + "'";

            using (DbDataReader reader = dbHelper.ExecuteReader(strSql, null))
            {
                if (reader.Read())
                {
                    customerLabel = new DataEntity();
                    customerLabel.Add("ID", DBNull.Value != reader["ID"] ? reader["ID"].ToString() : "");
                    customerLabel.Add("Name", DBNull.Value != reader["Name"] ? reader["Name"].ToString() : "");
                    customerLabel.Add("ServiceSpaceId", DBNull.Value != reader["ServiceSpaceId"] ? reader["ServiceSpaceId"].ToString() : "");
                }
                return(customerLabel);
            }
        }
        /// <summary>
        /// 获取动态字段数据
        /// </summary>
        private void getDataOfDynamicField()
        {
            DataEntity <DataElement> dataElements = new DataEntity <DataElement>();

            dataElements.Add("CompanyNameEn", "YY");
            string s3 = employeeInfo.getEmployeeInfoByCompanyNameEn3(dataElements);

            string s4 = employeeInfo.getEmployeeInfoByCompanyNameEn4(dataElements);

            DataEntity <DataElement> ei1 = employeeInfo.getEmployeeInfoByCompanyNameEn5("YY");
        }
예제 #7
0
        /// <summary>
        /// 获取所有客户标签
        /// </summary>
        /// <returns></returns>
        public List <DataEntity> GetCustomerLabels(string serviceSpaceId)
        {
            List <DataEntity> customerLabels = null;
            DBHelper          dbHelper       = new DBHelper(ConnectionString, DbProviderType.SqlServer);

            string strSql = @"SELECT  [ID],[ServiceSpaceId],[Name] FROM [CustomerLabel] where serviceSpaceId='" + serviceSpaceId + "'";

            using (DbDataReader reader = dbHelper.ExecuteReader(strSql, null))
            {
                customerLabels = new List <DataEntity>();
                DataEntity customerLabel = null;
                while (reader.Read())
                {
                    customerLabel = new DataEntity();
                    customerLabel.Add("ID", DBNull.Value != reader["ID"] ? reader["ID"].ToString() : "");
                    customerLabel.Add("Name", DBNull.Value != reader["Name"] ? reader["Name"].ToString() : "");
                    customerLabel.Add("ServiceSpaceId", DBNull.Value != reader["ServiceSpaceId"] ? reader["ServiceSpaceId"].ToString() : "");
                    customerLabels.Add(customerLabel);
                }
                return(customerLabels);
            }
        }
예제 #8
0
        /// <summary>
        /// 添加评价
        /// </summary>
        /// <param name="workOrderEvalution">评价信息</param>
        /// <returns></returns>
        public bool AddEvaluation(WorkOrderEvaluation workOrderEvalution)
        {
            if (workOrderEvalution == null)
            {
                return(false);
            }

            DataEntity workOrderEvalutionDataEntity = new DataEntity();

            workOrderEvalutionDataEntity.Add("WorkOrderID", string.IsNullOrEmpty(workOrderEvalution.WorkOrderID) ? "" : workOrderEvalution.WorkOrderID);
            workOrderEvalutionDataEntity.Add("OverallLevel", workOrderEvalution.OverallLevel);
            workOrderEvalutionDataEntity.Add("Lables", workOrderEvalution.Lables != null ? SerializationHelper.JsonSerialize(workOrderEvalution.Lables) : "");
            workOrderEvalutionDataEntity.Add("Evaluation", string.IsNullOrEmpty(workOrderEvalution.Evaluation) ? "" : workOrderEvalution.Evaluation);
            workOrderEvalutionDataEntity.Add("CustomerName", string.IsNullOrEmpty(workOrderEvalution.CustomerName) ? "" : workOrderEvalution.CustomerName);
            workOrderEvalutionDataEntity.Add("CustomerID", string.IsNullOrEmpty(workOrderEvalution.CustomerID) ? "" : workOrderEvalution.CustomerID);
            workOrderEvalutionDataEntity.Add("IsCustomerEvaluate", workOrderEvalution.IsCustomerEvaluate);
            return(_workOrderProvider.AddEvaluation(workOrderEvalutionDataEntity));
        }
예제 #9
0
        /// <summary>
        /// 添加签到
        /// </summary>
        /// <param name="signIn">签到信息</param>
        /// <returns></returns>
        public bool AddSignIn(SignIn signIn)
        {
            //参数验证
            if (signIn == null)
            {
                ErrorMsg = ErrorCode.ParameterNull;
                return(false);
            }

            DataEntity signInEntity = new DataEntity();

            signInEntity.Add("ID", string.IsNullOrEmpty(signIn.ID) ? "" : signIn.ID);
            signInEntity.Add("WorkOrderID", string.IsNullOrEmpty(signIn.WorkOrderID) ? "" : signIn.WorkOrderID);
            signInEntity.Add("Address", string.IsNullOrEmpty(signIn.Address) ? "" : signIn.Address);
            signInEntity.Add("StaffID", string.IsNullOrEmpty(signIn.StaffID) ? "" : signIn.StaffID);
            signInEntity.Add("Title", string.IsNullOrEmpty(signIn.Title) ? "" : signIn.Title);
            signInEntity.Add("WorkProcessID", string.IsNullOrEmpty(signIn.WorkProcessID) ? "" : signIn.WorkProcessID);
            return(_workOrderProvider.AddSignIn(signInEntity));
        }
예제 #10
0
        /// <summary>
        /// 从游标中读取数据实体
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private DataEntity GetDataEntityFromReader(DbDataReader reader)
        {
            DataEntity customer = new DataEntity();

            #region 组装数据
            customer.Add("ID", DBNull.Value != reader["ID"] ? reader["ID"].ToString() : string.Empty);
            customer.Add("ServiceSpaceID", DBNull.Value != reader["ServiceSpaceID"] ? reader["ServiceSpaceID"].ToString() : string.Empty);
            customer.Add("Name", DBNull.Value != reader["Name"] ? reader["Name"].ToString() : string.Empty);
            customer.Add("Gender", DBNull.Value != reader["Gender"] ? (int)reader["Gender"] : 0);
            customer.Add("Mobile", DBNull.Value != reader["Mobile"] ? reader["Mobile"].ToString() : string.Empty);
            customer.Add("Mail", DBNull.Value != reader["Mail"] ? reader["Mail"].ToString() : string.Empty);
            customer.Add("WeChat", DBNull.Value != reader["WeChat"] ? reader["WeChat"].ToString() : string.Empty);
            customer.Add("HeadImg", DBNull.Value != reader["HeadImg"] ? reader["HeadImg"].ToString() : string.Empty);
            customer.Add("UserName", DBNull.Value != reader["UserName"] ? reader["UserName"].ToString() : string.Empty);
            customer.Add("Password", DBNull.Value != reader["Password"] ? reader["Password"].ToString() : string.Empty);
            customer.Add("CompanyName", DBNull.Value != reader["CompanyName"] ? reader["CompanyName"].ToString() : string.Empty);
            customer.Add("Contact", DBNull.Value != reader["Contact"] ? reader["Contact"].ToString() : string.Empty);
            customer.Add("LabelIDs", DBNull.Value != reader["LabelIDs"] ? reader["LabelIDs"].ToString() : string.Empty);
            customer.Add("Area", DBNull.Value != reader["Area"] ? reader["Area"].ToString() : string.Empty);
            customer.Add("Remark", DBNull.Value != reader["Remark"] ? reader["Remark"].ToString() : string.Empty);
            customer.Add("Address", DBNull.Value != reader["Address"] ? reader["Address"].ToString() : string.Empty);
            customer.Add("CreateTime", DBNull.Value != reader["CreateTime"] ? Convert.ToDateTime(reader["CreateTime"]).ToString("yyyy-MM-dd") : string.Empty);
            customer.Add("UpdateTime", DBNull.Value != reader["UpdateTime"] ? Convert.ToDateTime(reader["UpdateTime"]).ToString("yyyy-MM-dd HH:mm:ss") : string.Empty);
            customer.Add("RecentService", DBNull.Value != reader["RecentService"] && !reader["RecentService"].ToString().Contains("1900") ? Convert.ToDateTime(reader["RecentService"]).ToString("yyyy-MM-dd HH:mm:ss") : string.Empty);
            #endregion
            return(customer);
        }
예제 #11
0
        /// <summary>
        /// 从游标中读取数据
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private DataEntity GetStaffFromReader(DbDataReader reader)
        {
            DataEntity staff = new DataEntity();

            staff.Add("ID", ReaderExists(reader, "ID") && DBNull.Value != reader["ID"] ? reader["ID"].ToString() : string.Empty);
            staff.Add("UserName", ReaderExists(reader, "UserName") && DBNull.Value != reader["UserName"] ? reader["UserName"].ToString() : string.Empty);
            staff.Add("Password", ReaderExists(reader, "Password") && DBNull.Value != reader["Password"] ? reader["Password"].ToString() : string.Empty);
            staff.Add("OrganizationID", ReaderExists(reader, "OrganizationID") && DBNull.Value != reader["OrganizationID"] ? reader["OrganizationID"].ToString() : string.Empty);
            staff.Add("OrganizationName", ReaderExists(reader, "OrganizationName") && DBNull.Value != reader["OrganizationName"] ? reader["OrganizationName"].ToString() : string.Empty);
            staff.Add("IsAdmin", ReaderExists(reader, "IsAdmin") && DBNull.Value != reader["IsAdmin"] ? (bool)reader["IsAdmin"] : false);
            staff.Add("Name", ReaderExists(reader, "Name") && DBNull.Value != reader["Name"] ? reader["Name"].ToString() : string.Empty);
            staff.Add("Gender", ReaderExists(reader, "Gender") && DBNull.Value != reader["Gender"] ? (int)reader["Gender"] : 0);
            staff.Add("Speciality", ReaderExists(reader, "Speciality") && DBNull.Value != reader["Speciality"] ? reader["Speciality"].ToString() : string.Empty);
            staff.Add("Titile", ReaderExists(reader, "Titile") && DBNull.Value != reader["Titile"] ? reader["Titile"].ToString() : string.Empty);
            staff.Add("WeChat", ReaderExists(reader, "WeChat") && DBNull.Value != reader["WeChat"] ? reader["WeChat"].ToString() : string.Empty);
            staff.Add("Telephone", ReaderExists(reader, "Telephone") && DBNull.Value != reader["Telephone"] ? reader["Telephone"].ToString() : string.Empty);
            staff.Add("Email", ReaderExists(reader, "Email") && DBNull.Value != reader["Email"] ? reader["Email"].ToString() : string.Empty);
            staff.Add("HeadImg", ReaderExists(reader, "HeadImg") && DBNull.Value != reader["HeadImg"] ? reader["HeadImg"].ToString() : string.Empty);
            staff.Add("Description", ReaderExists(reader, "Description") && DBNull.Value != reader["Description"] ? reader["Description"].ToString() : string.Empty);
            staff.Add("Profile", ReaderExists(reader, "Profile") && DBNull.Value != reader["Profile"] ? reader["Profile"].ToString() : string.Empty);
            staff.Add("CreateTime", ReaderExists(reader, "CreateTime") && DBNull.Value != reader["CreateTime"] ? Convert.ToDateTime(reader["CreateTime"]).ToString("yyyy-MM-dd") : string.Empty);
            staff.Add("TelUpdateTime", ReaderExists(reader, "TelUpdateTime") && DBNull.Value != reader["TelUpdateTime"] ? Convert.ToDateTime(reader["TelUpdateTime"]).ToString("yyyy-MM-dd") : string.Empty);
            staff.Add("IsPushVoice", ReaderExists(reader, "IsPushVoice") && DBNull.Value != reader["IsPushVoice"] ? (bool)reader["IsPushVoice"] : true);
            staff.Add("IsReceivePush", ReaderExists(reader, "IsReceivePush") && DBNull.Value != reader["IsReceivePush"] ? (bool)reader["IsReceivePush"] : true);
            return(staff);
        }
예제 #12
0
        /// <summary>
        /// 保存客户信息
        /// </summary>
        /// <param name="customer">客户模型</param>
        /// <returns></returns>
        public bool Save(Customer customer)
        {
            //参数验证
            if (customer == null || string.IsNullOrEmpty(customer.Mobile) || string.IsNullOrEmpty(customer.ServiceSpaceID))
            {
                return(false);
            }

            //客户是否存在
            DataEntity customerEntity = null;

            if (!string.IsNullOrEmpty(customer.ID))
            {
                customerEntity = _customerProvider.Get(customer.ID);
            }
            if (customerEntity == null)
            {
                customer.ID    = System.Guid.NewGuid().ToString();
                customerEntity = new DataEntity();
                customerEntity.Add("ID", customer.ID);
                customerEntity.Add("ServiceSpaceID", string.IsNullOrEmpty(customer.ServiceSpaceID) ? "" : customer.ServiceSpaceID);
                customerEntity.Add("Address", string.IsNullOrEmpty(customer.Address) ? "" : customer.Address);
                customerEntity.Add("Area", string.IsNullOrEmpty(customer.Area) ? "" : customer.Area);
                customerEntity.Add("Remark", string.IsNullOrEmpty(customer.Remark) ? "" : customer.Remark);
                customerEntity.Add("CompanyName", string.IsNullOrEmpty(customer.CompanyName) ? "" : customer.CompanyName);
                customerEntity.Add("Gender", (int)customer.Gender);
                customerEntity.Add("Mail", string.IsNullOrEmpty(customer.Mail) ? "" : customer.Mail);
                customerEntity.Add("Mobile", string.IsNullOrEmpty(customer.Mobile) ? "" : customer.Mobile);
                customerEntity.Add("Name", string.IsNullOrEmpty(customer.Name) ? "" : customer.Name);
                customerEntity.Add("UserName", string.IsNullOrEmpty(customer.UserName) ? customer.Mobile : customer.UserName);
                customerEntity.Add("Password", string.IsNullOrEmpty(customer.Password) ? "" : customer.Password);
                customerEntity.Add("WeChat", string.IsNullOrEmpty(customer.WeChat) ? "" : customer.WeChat);
                customerEntity.Add("RecentService", string.IsNullOrEmpty(customer.RecentService) ? "" : customer.RecentService);
                customerEntity.Add("HeadImg", string.IsNullOrEmpty(customer.HeadImg) ? "" : customer.HeadImg);
                customerEntity.Add("Contact", string.IsNullOrEmpty(customer.Contact) ? "" : customer.Contact);
                customerEntity.Add("LabelIDs", string.IsNullOrEmpty(customer.LabelIDs) ? "" : customer.LabelIDs);
                customerEntity.Add("ServiceNetworkID", string.IsNullOrEmpty(customer.ServiceNetworkID) ? "" : customer.ServiceNetworkID);
                return(_customerProvider.Add(customerEntity));
            }
            else
            {
                customerEntity["Address"].Value       = string.IsNullOrEmpty(customer.Address) ? "" : customer.Address;
                customerEntity["Area"].Value          = string.IsNullOrEmpty(customer.Area) ? "" : customer.Area;
                customerEntity["Remark"].Value        = string.IsNullOrEmpty(customer.Remark) ? "" : customer.Remark;
                customerEntity["CompanyName"].Value   = string.IsNullOrEmpty(customer.CompanyName) ? "" : customer.CompanyName;
                customerEntity["Gender"].Value        = (int)customer.Gender;
                customerEntity["Mail"].Value          = string.IsNullOrEmpty(customer.Mail) ? "" : customer.Mail;
                customerEntity["Mobile"].Value        = string.IsNullOrEmpty(customer.Mobile) ? "" : customer.Mobile;
                customerEntity["Name"].Value          = string.IsNullOrEmpty(customer.Name) ? "" : customer.Name;
                customerEntity["Password"].Value      = string.IsNullOrEmpty(customer.Password) ? "" : customer.Password;
                customerEntity["WeChat"].Value        = string.IsNullOrEmpty(customer.WeChat) ? "" : customer.WeChat;
                customerEntity["RecentService"].Value = string.IsNullOrEmpty(customer.RecentService) ? "" : customer.RecentService;
                customerEntity["HeadImg"].Value       = string.IsNullOrEmpty(customer.HeadImg) ? "" : customer.HeadImg;
                customerEntity["Contact"].Value       = string.IsNullOrEmpty(customer.Contact) ? "" : customer.Contact;
                customerEntity["LabelIDs"].Value      = string.IsNullOrEmpty(customer.LabelIDs) ? "" : customer.LabelIDs;

                return(_customerProvider.Update(customerEntity));
            }
        }
예제 #13
0
 /// <summary>
 /// Adds the specified entity.
 /// </summary>
 /// <param name="obj">The entity object.</param>
 /// <returns>Added entity</returns>
 public T Add(T obj)
 {
     return(DataEntity.Add(obj));
 }