Ejemplo n.º 1
0
        public static void write(HanderType HanderType, TableBase tableBase)
        {
            string        section        = Convert.ToString(HanderType);
            StringBuilder builder_string = new StringBuilder();

            switch (HanderType)
            {
            case HanderType.custom:
                cust_customer cs = tableBase as cust_customer;

                string info = "插入客户:" + cs.cust_name + " ";
                //WritePrivateProfileString(section,"add","")
                break;

            case HanderType.linkman:
                break;

            case HanderType.report:
                break;

            case HanderType.share:
                break;

            case HanderType.workplane:
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加跟进记录
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="newfollow_up"></param>
        /// <param name="_pictures"></param>
        private void add_follow(string guid, follow_up newfollow_up, string _pictures)
        {
            try
            {
                //通知领导进行添加
                admin_add_follow(guid, newfollow_up);

                //添加跟进记录
                jsonModel       = Constant.bbc.add_follow_up(newfollow_up, _pictures);
                newfollow_up.id = Convert.ToInt64(jsonModel.retData);
                //缓存添加图片
                AddPicture_helper(newfollow_up, _pictures);

                //客户列表,当前用户【更改拜访记录】
                List <cust_customer> cust_customer_selfs = cust_customer_handle.dic_Self[guid];
                cust_customer        customer_follow     = cust_customer_selfs.FirstOrDefault(item => item.id == newfollow_up.follow_cust_id);
                if (customer_follow != null)
                {
                    customer_follow.cust_followdate = DateTime.Now;
                    Constant.cust_customer_S.Update(customer_follow);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 编辑客户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int add_cust_customer(cust_customer model, string link_ids)
        {
            int result = 0;

            SqlParameter[] param =
            {
                new SqlParameter("@id",             SqlDbType.Int),
                new SqlParameter("@cust_parent_id", model.cust_parent_id == null?0:model.cust_parent_id),
                new SqlParameter("@cust_name",      model.cust_name == null?"":model.cust_name),
                new SqlParameter("@cust_type",      model.cust_type == null?0:model.cust_type),
                new SqlParameter("@cust_level",     model.cust_level == null?0:model.cust_level),
                new SqlParameter("@cust_category",  model.cust_category == null?0:model.cust_category),
                new SqlParameter("@cust_address",   model.cust_address == null?"":model.cust_address),
                new SqlParameter("@cust_location",  model.cust_location == null?"":model.cust_location),
                new SqlParameter("@cust_users",     model.cust_users == null?"":model.cust_users),
                new SqlParameter("@cust_usersname", model.cust_usersname),
                new SqlParameter("@cust_x",         model.cust_x == null?0:model.cust_x),
                new SqlParameter("@cust_y",         model.cust_y == null?0:model.cust_y),
                new SqlParameter("@link_ids",       link_ids == null?"":link_ids)
            };
            param[0].Direction = ParameterDirection.Output;
            object obj = SQLHelp.ExecuteNonQuery("add_cust_customer", CommandType.StoredProcedure, param);

            result = Convert.ToInt32(param[0].Value.ToString());
            return(result);
        }
Ejemplo n.º 4
0
        public JsonModel edit_cust_customer(cust_customer model, string link_ids)
        {
            JsonModel jsonModel = new JsonModel();

            try
            {
                int result = DALBaseCommon.edit_cust_customer(model, link_ids);
                jsonModel = new JsonModel()
                {
                    errNum  = 0,
                    errMsg  = "success",
                    retData = result
                };
                return(jsonModel);
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errNum  = 400,
                    errMsg  = ex.Message,
                    retData = ""
                };
                return(jsonModel);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 添加联系人
        /// </summary>
        /// <param name="Request"></param>
        /// <param name="guid">用户id</param>
        private void add_linkman(string guid, string cust_leaders, cust_linkman new_linkman)
        {
            try
            {
                cust_customer customer = cust_customer_handle.list_All.FirstOrDefault(t => t.cust_category == 1 && t.id == new_linkman.link_cust_id);
                if (
                    customer == null)
                {
                    //姓名、部门、手机号码、性别一致的认定为重复联系人
                    cust_linkman linkman = cust_linkman_handle.list_All.FirstOrDefault(t => !string.IsNullOrEmpty(t.link_phonenumber) && t.link_phonenumber == new_linkman.link_phonenumber

                                                                                       );
                    if (linkman == null)
                    {
                        if (!dic_Self[guid].Contains(new_linkman))
                        {
                            //缓存添加客户
                            dic_Self[guid].Add(new_linkman);
                            //不需要开启线程操作数据库
                            jsonModel      = Constant.bbc.add_cust_linkman(new_linkman);
                            new_linkman.id = Convert.ToInt32(jsonModel.retData);

                            //开启线程操作数据库
                            new Thread(() =>
                            {
                                try
                                {
                                    //通知领导进行添加
                                    admin_add_linkman(guid, new_linkman);

                                    //通知其他负责人进行添加
                                    Add_Other_Users(new_linkman, cust_leaders);
                                }
                                catch (Exception ex)
                                {
                                    LogHelper.Error(ex);
                                }
                            })
                            {
                                IsBackground = true
                            }.Start();
                        }
                    }
                    else
                    {
                        jsonModel = Constant.get_jsonmodel(0, "failed", "联系人已存在,不可重复添加");
                    }
                }
                else
                {
                    jsonModel = Constant.get_jsonmodel(0, "failed", "您没有权限添加公共联系人");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 客户添加
        /// </summary>
        /// <param name="dic_data"></param>
        /// <param name="i"></param>
        /// <param name="customers"></param>
        /// <param name="customerID"></param>
        /// <returns></returns>
        private long custom_edit(List <Dictionary <string, object> > dic_data, int i, List <cust_customer> customers, long customerID)
        {
            cust_customer cust_select = customers[0];

            //获取联系人ID
            customerID = (long)cust_select.id;
            if (Constant.IsInput_CoverAddress)
            {
                //设置经纬度
                customer_position_setting(dic_data, i, cust_select);
            }
            //数据库更改客户信息
            Constant.cust_customer_S.Update(cust_select);
            exit_customer_count++;
            Dictionary <string, string> msg = new Dictionary <string, string>();

            msg.Add("cust_name", cust_select.cust_name);
            msg.Add("cust_usersname", cust_select.cust_usersname);
            msg.Add("msg", "该客户已存在");
            Failinfo.Add(msg);
            reinfo.Add(i + "、该客户已存在:" + cust_select.cust_name + "      负责人:" + customers[0].cust_usersname);
            return(customerID);
        }
Ejemplo n.º 7
0
        public static int edit_cust_customer(cust_customer model, string link_ids)
        {
            int result = 0;

            SqlParameter[] param =
            {
                new SqlParameter("@id",             model.id),
                new SqlParameter("@cust_parent_id", model.cust_parent_id == null?0:model.cust_parent_id),
                new SqlParameter("@cust_name",      model.cust_name == null?"":model.cust_name),
                new SqlParameter("@cust_type",      model.cust_type == null?0:model.cust_type),
                new SqlParameter("@cust_level",     model.cust_level == null?0:model.cust_level),
                new SqlParameter("@cust_category",  model.cust_category == null?0:model.cust_category),
                new SqlParameter("@cust_address",   model.cust_address == null?"":model.cust_address),
                new SqlParameter("@cust_location",  model.cust_location == null?"":model.cust_location),
                new SqlParameter("@cust_users",     model.cust_users == null?"":model.cust_users),
                new SqlParameter("@cust_usersname", model.cust_usersname),
                new SqlParameter("@cust_x",         model.cust_x == null?0:model.cust_x),
                new SqlParameter("@cust_y",         model.cust_y == null?0:model.cust_y),
                new SqlParameter("@link_ids",       link_ids == null?"":link_ids),
                new SqlParameter("@cust_isdelete",  model.cust_isdelete)
            };
            result = Convert.ToInt32(SQLHelp.ExecuteScalar("edit_cust_customer", System.Data.CommandType.StoredProcedure, param.ToArray()));
            return(result);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 客户添加
        /// </summary>
        /// <param name="dic_data"></param>
        /// <param name="i"></param>
        /// <param name="customers"></param>
        /// <param name="customerID"></param>
        /// <returns></returns>
        private long custom_edit(List <Dictionary <string, object> > dic_data, int i, List <cust_customer> customers, long customerID)
        {
            cust_customer cust_select = customers[0];

            //获取联系人ID
            customerID = (long)cust_select.id;
            if (Constant.IsInput_CoverAddress)
            {
                //设置经纬度
                customer_position_setting(dic_data, i, cust_select);
            }
            //数据库更改客户信息
            Constant.cust_customer_S.Update(cust_select);
            exit_customer_count++;
            this.Panel1.Controls.Add(new TextBox()
            {
                Width = new Unit(100, UnitType.Percentage), Text = i + "、该客户已存在:" + cust_select.cust_name + "      负责人:" + customers[0].cust_usersname + Environment.NewLine, ForeColor = Color.Red
            });
            this.Panel1.Controls.Add(new Literal()
            {
                Text = "<br />"
            });
            return(customerID);
        }
Ejemplo n.º 9
0
        public void edit_sign_in(HttpContext context, string guid)
        {
            HttpRequest  Request  = context.Request;
            HttpResponse response = context.Response;
            long         id       = RequestHelper.long_transfer(Request, "id");

            try
            {
                sign_in si = new sign_in();
                si.id              = id;
                si.sign_date       = DateTime.Now;
                si.sign_cust_id    = RequestHelper.long_transfer(Request, "sign_cust_id");
                si.sign_location   = RequestHelper.string_transfer(Request, "sign_location");
                si.sign_x          = RequestHelper.decimal_transfer(Request, "sign_x");
                si.sign_y          = RequestHelper.decimal_transfer(Request, "sign_y");
                si.sign_address    = RequestHelper.string_transfer(Request, "sign_address");
                si.sign_offset     = Convert.ToInt32(RequestHelper.decimal_transfer(Request, "sign_offset"));
                si.sign_isdelete   = "0";
                si.sign_createdate = DateTime.Now;
                si.sign_updatedate = DateTime.Now;

                //修改《暂时修改功能》
                if (id > 0)
                {
                }
                else
                {
                    //放在此位置的原因是  领导修改时不更改当前编辑人的信息
                    si.sign_userid   = RequestHelper.string_transfer(Request, "sign_userid");
                    si.sign_username = RequestHelper.string_transfer(Request, "sign_username");

                    if (!dic_Self[guid].Contains(si))
                    {
                        //同一个人  同一个客户  【五分钟之内】
                        int count = dic_Self[guid].Count(s => s.sign_userid == si.sign_userid &&
                                                         s.sign_cust_id == si.sign_cust_id && ((DateTime)s.sign_date).Year == DateTime.Now.Year && ((DateTime)s.sign_date).DayOfYear == DateTime.Now.DayOfYear &&
                                                         ((DateTime)si.sign_date - (DateTime)s.sign_date).Minutes < Constant.SignLimitTime);

                        if (count == 0)
                        {
                            if (string.IsNullOrEmpty(si.sign_address))
                            {
                                var model = PositionHelper.GeoCoder(Convert.ToString(si.sign_y), Convert.ToString(si.sign_x));
                                if (model != null)
                                {
                                    si.sign_address = model.Result.Formatted_Address;
                                }
                            }

                            //缓存添加客户
                            dic_Self[guid].Add(si);
                            jsonModel = Constant.get_jsonmodel(0, "success", 1);
                            new Thread(() =>
                            {
                                try
                                {
                                    //通知领导进行添加
                                    admin_add_sign(guid, si);
                                    jsonModel = Constant.sign_in_S.Add(si);
                                    si.id     = Convert.ToInt32(jsonModel.retData);
                                    //客户列表,当前用户【更改拜访记录】
                                    List <cust_customer> cust_customer_selfs = cust_customer_handle.dic_Self[guid];
                                    cust_customer customer_sign = cust_customer_selfs.FirstOrDefault(item => item.id == si.sign_cust_id);
                                    if (customer_sign != null)
                                    {
                                        customer_sign.cust_followdate = DateTime.Now;
                                        Constant.cust_customer_S.Update(customer_sign);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    LogHelper.Error(ex);
                                }
                            })
                            {
                                IsBackground = true
                            }.Start();
                        }
                        else
                        {
                            jsonModel = Constant.get_jsonmodel(5, "failed", "同一客户,禁止在5分钟之内重复签到");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = Constant.ErrorGetData(ex);
            }
            finally
            {
                response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 签到列表
        /// </summary>
        /// <param name="context"></param>
        public void get_sign_list(HttpContext context, string guid)
        {
            HttpRequest Request = context.Request;

            try
            {
                //分页信息
                int page_Index = RequestHelper.int_transfer(Request, "PageIndex");
                int page_Size  = RequestHelper.int_transfer(Request, "PageSize");
                //開始日期
                DateTime stardate = RequestHelper.DateTime_transfer(Request, "stardate");
                //結束日期
                DateTime enddate = RequestHelper.DateTime_transfer(Request, "enddate").AddDays(1);

                //部门的ID号【传参 】
                string departmentID = RequestHelper.string_transfer(Request, "departmentID");
                string memmberID    = RequestHelper.string_transfer(Request, "memmberID");

                var sign_in_selfs = from t in dic_Self[guid] select t;

                //指定签到客户
                long sign_cust_id = RequestHelper.long_transfer(Request, "sign_cust_id");

                //获取签到列表【筛选】
                sign_in_selfs = get_signs_helper(stardate, enddate, sign_in_selfs, sign_cust_id);

                sign_in_selfs = Check_And_Get_List_dep(departmentID, memmberID, sign_in_selfs);

                int sign_count = sign_in_selfs.Count();
                //进行分页
                List <sign_in> list_sign_in_page = GetPageByLinq(sign_in_selfs.ToList(), page_Index, page_Size);

                //对象集合转为dic集合列表
                List <Dictionary <string, object> > dicList = ConverList <sign_in> .ListToDic(list_sign_in_page);

                //客户列表,当前用户
                List <cust_customer> cust_customer_selfs = cust_customer_handle.dic_Self[guid];
                foreach (var item in dicList)
                {
                    item["sign_date"] = Convert.ToDateTime(item["sign_date"]).ToString("yyyy-MM-dd  HH:mm");
                    long          sign_cust_id_c = Convert.ToInt64(item["sign_cust_id"]);
                    cust_customer _cust_customer = (from t in cust_customer_selfs
                                                    where sign_cust_id_c == (long)t.id
                                                    select t).FirstOrDefault();
                    if (_cust_customer != null)
                    {
                        item.Add("cust_name", _cust_customer.cust_name);
                    }
                }
                string status = string.Empty;

                //返回数据
                PagedDataModel <Dictionary <string, object> > psd = new PagedDataModel <Dictionary <string, object> >()
                {
                    PagedData = dicList, PageIndex = page_Index, PageSize = page_Size, RowCount = sign_count
                };
                //数据包(json格式)
                jsonModel = new JsonModel()
                {
                    errNum = 0, errMsg = "success", retData = psd, status = status
                };
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = Constant.ErrorGetData(ex);
            }
            finally
            {
                //管理者
                if (Constant.dicLimit_P.ContainsKey(guid))
                {
                    jsonModel.status = "IsAdmin";
                }
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 位置设置
        /// </summary>
        /// <param name="dic_data">excel拿出的数据</param>
        /// <param name="i">循环变量</param>
        /// <param name="cust_customer">客户</param>
        private void customer_position_setting(List <Dictionary <string, object> > dic_data, int i, cust_customer cust_customer)
        {
            try
            {
                string address = Convert.ToString(dic_data[i]["F12"]).Trim();

                if (!string.IsNullOrEmpty(address))
                {
                    String addressStr = gaode_api_get_position + address;

                    Position_Model data = GaoDeHelper.GetPosition(addressStr, "UTF-8");
                    if (data.geocodes.Count > 0)
                    {
                        string location = data.geocodes[0].location;
                        if (!string.IsNullOrEmpty(location))
                        {
                            cust_customer.cust_x = Convert.ToDecimal(location.Split(new char[] { ',' })[0]);
                            cust_customer.cust_y = Convert.ToDecimal(location.Split(new char[] { ',' })[1]);
                            if (cust_customer.cust_usersname == pub_cust_name)
                            {
                                cust_customer.cust_GaoDe   = address;
                                cust_customer.cust_address = data.geocodes[0].formatted_address;
                            }
                            else
                            {
                                cust_customer.cust_GaoDe   = data.geocodes[0].formatted_address;
                                cust_customer.cust_address = address;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }