Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取客户和联系人姓名
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="fp"></param>
        /// <param name="follow"></param>
        private static void get_customer_linkman(string guid, follow_up fp, follow follow)
        {
            try
            {
                #region 获取客户信息\联系人

                //联系人列表,当前用户
                List <cust_linkman> cust_linkman_selfs = cust_linkman_handle.list_All;

                //获取联系人信息
                string link_id      = fp.follow_link_id.ToString();
                long   link_id_long = Convert.ToInt64(link_id);
                //获取指定的客户【在自己的客户列表里获取】
                cust_linkman cust_linkman = (from t in cust_linkman_selfs
                                             where t.id == link_id_long
                                             select t).FirstOrDefault(); if (cust_linkman != null)
                {
                    follow.follow_up_info.follow_cust_name = cust_linkman.link_cust_name;
                    follow.follow_up_info.follow_link_name = cust_linkman.link_name;
                }

                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
            }
        }
Exemplo n.º 3
0
        ///// <summary>
        ///// 新增签到
        ///// </summary>
        ///// <param name="model"></param>
        ///// <returns></returns>
        //public static int edit_sign_in(sign_in model)
        //{
        //    int result = 0;
        //    SqlParameter[] param = {
        //            new SqlParameter("@id", model.id),
        //            new SqlParameter("@sign_userid", model.sign_userid),
        //            new SqlParameter("@sign_username", model.sign_username),
        //            new SqlParameter("@sign_date", model.sign_date),
        //            new SqlParameter("@sign_cust_id", model.sign_cust_id),
        //            new SqlParameter("@sign_location", model.sign_location),
        //            new SqlParameter("@sign_address", model.sign_address),
        //            new SqlParameter("@sign_offset", model.sign_offset)
        //    };
        //    param[0].Direction = ParameterDirection.Output;
        //    object obj = SQLHelp.ExecuteNonQuery("edit_sign_in", CommandType.StoredProcedure, param);
        //    result = Convert.ToInt32(param[0].Value.ToString());
        //    return result;
        //}
        /// <summary>
        /// 新增跟进记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int add_follow_up(follow_up model, string picture)
        {
            int result = 0;

            SqlParameter[] param =
            {
                new SqlParameter("@id",                SqlDbType.Int),
                new SqlParameter("@follow_userid",     model.follow_userid == null?"":model.follow_userid),
                new SqlParameter("@follow_username",   model.follow_username == null?"":model.follow_username),
                new SqlParameter("@follow_cust_id",    model.follow_cust_id == null?0:model.follow_cust_id),
                new SqlParameter("@follow_link_id",    model.follow_link_id == null?0:model.follow_link_id),
                new SqlParameter("@follow_date",       model.follow_date == null?DateTime.Now:model.follow_date),
                new SqlParameter("@follow_content",    model.follow_content == null?"":model.follow_content),
                new SqlParameter("@follow_type",       model.follow_type == null?0:model.follow_type),
                new SqlParameter("@follow_status",     model.follow_status == null?"":model.follow_status),
                new SqlParameter("@follow_remaindate", model.follow_remaindate == null?DateTime.Now:model.follow_remaindate),
                new SqlParameter("@follow_address",    model.follow_address == null?"":model.follow_address),
                new SqlParameter("@picture",           picture == null?"":picture)
            };
            param[0].Direction = ParameterDirection.Output;
            object obj = SQLHelp.ExecuteNonQuery("add_follow_up", CommandType.StoredProcedure, param);

            result = Convert.ToInt32(param[0].Value.ToString());
            return(result);
        }
Exemplo n.º 4
0
        public JsonModel edit_follow_up(follow_up model, string picture)
        {
            JsonModel jsonModel = new JsonModel();

            try
            {
                int result = DALBaseCommon.edit_follow_up(model, picture);
                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);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取根据记录【指定ID】
        /// </summary>
        /// <param name="context"></param>

        public void get_follow_up(HttpContext context, string guid)
        {
            HttpRequest Request = context.Request;

            try
            {
                long   id             = RequestHelper.long_transfer(Request, "id");
                long   follow_cust_id = RequestHelper.long_transfer(Request, "follow_cust_id");
                long   follow_link_id = RequestHelper.long_transfer(Request, "follow_link_id");
                string follow_type    = RequestHelper.string_transfer(Request, "follow_type");
                //跟进列表
                List <follow_up> follow_selfs = dic_Self[guid];
                //指定的一个客户
                follow_up follow_up = (from t in follow_selfs
                                       where t.id == id
                                       select t).FirstOrDefault();
                Dictionary <string, object> dic_follow_up = ConverList <follow_up> .T_ToDic(follow_up);

                //联系人列表,当前用户
                List <cust_linkman> cust_linkman_selfs = cust_linkman_handle.dic_Self[guid];
                //联系人名称和客户名称
                cust_linkman cust_linkman = (from t in cust_linkman_selfs
                                             where t.id == follow_up.follow_link_id
                                             select t).FirstOrDefault();
                if (cust_linkman != null)
                {
                    dic_follow_up["follow_link_name"] = cust_linkman.link_name;
                    dic_follow_up["follow_cust_name"] = cust_linkman.link_cust_name;
                }
                //跟进类型
                dic_follow_up["follow_type_name"] = LevelHelper.Getfollow_level(follow_up.follow_type.ToString());
                if (Constant.list_picture_All != null)
                {
                    //获取指定的图片【类型 和ID】
                    List <picture> listp = (from t in Constant.list_picture_All
                                            where t.pic_en_table == "follow_up" && t.pic_table_id == id
                                            select t).ToList();
                    string pic = "";
                    foreach (picture p in listp)
                    {
                        pic += p.pic_url + ',';
                    }
                    dic_follow_up["pic"] = pic.Trim(',');
                }
                jsonModel = Constant.get_jsonmodel(0, "success", dic_follow_up);
            }
            catch (Exception ex)
            {
                jsonModel = Constant.ErrorGetData(ex);
            }
            finally
            {
                string jsonString = Constant.jss.Serialize(jsonModel);
                context.Response.Write("{\"result\":" + jsonString + "}");
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取图片评论和点赞
        /// </summary>
        /// <param name="fp"></param>
        /// <param name="follow"></param>
        private static void get_picture_praise_comment(follow_up fp, follow follow)
        {
            try
            {
                #region 获取图片

                if (Constant.list_picture_All != null)
                {
                    //获取指定的图片【类型 和ID】
                    List <picture> list_picture = (from t in Constant.list_picture_All
                                                   where t.pic_en_table == "follow_up" && t.pic_table_id == (int)fp.id
                                                   select t).ToList();
                    follow.picture = ConverList <picture> .ListToDic(list_picture);
                }

                #endregion

                #region 获取评论

                //获取指定的评论
                List <comment> list_comment = (from t in comment_handle.list_All
                                               where t.com_table_id == (int)fp.id && t.com_isdelete == "0" && t.com_type == "1"
                                               select t).ToList();
                follow.comment = ConverList <comment> .ListToDic(list_comment);

                #endregion

                #region 获取点赞人

                List <praise> list_praise = (from t in praise_handle.list_All
                                             where t.praise_table_id == (int)fp.id && t.praise_type == "1"
                                             select t).ToList();
                follow.praise = ConverList <praise> .ListToDic(list_praise);

                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 编辑跟进记录
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="Request"></param>
        /// <param name="id"></param>
        /// <param name="follow_up"></param>
        private void edit_follow(string guid, long id, follow_up follow_up, string _pictures)
        {
            try
            {
                //跟进列表
                List <follow_up> follow_selfs   = dic_Self[guid];
                follow_up        edit_follow_up = follow_selfs.FirstOrDefault(item => item.id == id);
                if (edit_follow_up != null)
                {
                    edit_follow_up.follow_cust_id    = follow_up.follow_cust_id;
                    edit_follow_up.follow_link_id    = follow_up.follow_link_id;
                    edit_follow_up.follow_content    = follow_up.follow_content;
                    edit_follow_up.follow_status     = follow_up.follow_status;
                    edit_follow_up.follow_remaindate = follow_up.follow_remaindate;
                    edit_follow_up.follow_isdelete   = follow_up.follow_isdelete;
                    edit_follow_up.follow_address    = follow_up.follow_address;

                    //成功提示
                    jsonModel = Constant.get_jsonmodel(0, "success", 1);
                    //开启线程操作数据库
                    new Thread(() =>
                    {
                        try
                        {
                            editpicture_helper(id, _pictures, edit_follow_up);
                        }
                        catch (Exception ex)
                        {
                            LogHelper.Error(ex);
                        }
                    })
                    {
                        IsBackground = true
                    }.Start();
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
Exemplo n.º 8
0
        public static int edit_follow_up(follow_up model, string picture)
        {
            int result = 0;

            SqlParameter[] param =
            {
                new SqlParameter("@id",                model.id),
                new SqlParameter("@follow_userid",     model.follow_userid == null?"":model.follow_userid),
                new SqlParameter("@follow_username",   model.follow_username == null?"":model.follow_username),
                new SqlParameter("@follow_cust_id",    model.follow_cust_id == null?0:model.follow_cust_id),
                new SqlParameter("@follow_link_id",    model.follow_link_id == null?0:model.follow_link_id),
                new SqlParameter("@follow_date",       model.follow_date == null?DateTime.Now:model.follow_date),
                new SqlParameter("@follow_content",    model.follow_content == null?"":model.follow_content),
                new SqlParameter("@follow_type",       model.follow_type == null?0:model.follow_type),
                new SqlParameter("@follow_status",     model.follow_status == null?"":model.follow_status),
                new SqlParameter("@follow_remaindate", model.follow_remaindate == null?DateTime.Now:model.follow_remaindate),
                new SqlParameter("@follow_address",    model.follow_address == null?"":model.follow_address),
                new SqlParameter("@picture",           picture == null?"":picture)
            };
            result = Convert.ToInt32(SQLHelp.ExecuteScalar("edit_cust_customer", System.Data.CommandType.StoredProcedure, param.ToArray()));
            return(result);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 通知领导我已添加跟进
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="follow_up"></param>
        private static void admin_add_follow(string guid, follow_up follow_up)
        {
            try
            {
                //通知领导我已添加跟进
                if (Constant.dic_custs_users.ContainsKey(guid))
                {
                    if (!list_All.Contains(follow_up))
                    {
                        //当前添加跟进
                        list_All.Add(follow_up);
                    }

                    //获取上级的guid
                    List <string> commonAdmin_CustursID = Constant.dic_custs_users[guid];

                    //上级列表
                    foreach (var item in commonAdmin_CustursID)
                    {
                        //若领导在线,添加当前添加的跟进
                        if (dic_Self.ContainsKey(item))
                        {
                            //跟进列表,当前跟进
                            List <follow_up> follow_up_admins = dic_Self[item];
                            if (!follow_up_admins.Contains(follow_up))
                            {
                                follow_up_admins.Add(follow_up);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 缓存添加图片
        /// </summary>
        /// <param name="newfollow_up"></param>
        /// <param name="_pictures"></param>
        private static picture AddPicture_helper(follow_up newfollow_up, string _pictures)
        {
            picture picturemodel = null;

            try
            {
                //图片之前已经用存储过程和跟进记录一起插入

                if (!string.IsNullOrEmpty(_pictures))
                {
                    string[] _pics = _pictures.Split(',');
                    for (int i = 0; i < _pics.Length; i++)
                    {
                        picturemodel = new picture()
                        {
                            pic_en_table   = "follow_up",
                            pic_cn_table   = "跟进记录",
                            pic_table_id   = Convert.ToInt32(newfollow_up.id),
                            pic_url        = _pics[i],
                            pic_createdate = DateTime.Now,
                            pic_creator    = 1,
                            pic_updatedate = DateTime.Now,
                            pic_updateuser = 1,
                            pic_isdelete   = "0",
                            pic_remark     = "新增跟进记录",
                        };
                        Constant.list_picture_All.Add(picturemodel);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(picturemodel);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 编辑图片,若没有则添加
        /// </summary>
        /// <param name="id"></param>
        /// <param name="_pictures"></param>
        /// <param name="edit_follow_up"></param>
        private static void editpicture_helper(long id, string _pictures, follow_up edit_follow_up)
        {
            try
            {
                picture edit_picture = Constant.list_picture_All.FirstOrDefault(item => item.id == id);
                if (edit_picture != null)
                {
                    edit_picture.pic_updatedate = DateTime.Now;
                    edit_picture.pic_url        = _pictures;

                    Constant.follow_up_S.Update(edit_follow_up);
                    Constant.picture_S.Update(edit_picture);
                }
                else
                {
                    picture pictureModel = AddPicture_helper(edit_follow_up, _pictures);
                    Constant.picture_S.Add(pictureModel);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 新增跟进记录
        /// </summary>
        /// <param name="context"></param>
        public void add_follow_up(HttpContext context, string guid)
        {
            HttpRequest  Request  = context.Request;
            HttpResponse response = context.Response;

            try
            {
                long id = RequestHelper.long_transfer(Request, "id");

                follow_up newfollow_up = new follow_up();
                newfollow_up.follow_cust_id    = RequestHelper.int_transfer(Request, "follow_cust_id");
                newfollow_up.follow_link_id    = RequestHelper.int_transfer(Request, "follow_link_id");
                newfollow_up.follow_type       = int.Parse(RequestHelper.string_transfer(Request, "follow_type"));
                newfollow_up.follow_content    = RequestHelper.string_transfer(Request, "follow_content");
                newfollow_up.follow_status     = RequestHelper.string_transfer(Request, "follow_status");
                newfollow_up.follow_remaindate = RequestHelper.DateTime_transfer(Request, "follow_remaindate");
                newfollow_up.follow_address    = RequestHelper.string_transfer(Request, "follow_address");
                string _pictures = RequestHelper.string_transfer(Request, "picture");
                //修改《暂时修改功能》
                if (id > 0)
                {
                    //编辑跟进记录
                    edit_follow(guid, id, newfollow_up, _pictures);
                }
                else if (id == 0)
                {
                    newfollow_up.follow_userid     = RequestHelper.string_transfer(Request, "follow_userid");   //用户编号
                    newfollow_up.follow_username   = RequestHelper.string_transfer(Request, "follow_username"); //用户姓名
                    newfollow_up.follow_createdate = DateTime.Now;
                    newfollow_up.follow_date       = RequestHelper.DateTime_transfer(Request, "follow_date");
                    newfollow_up.follow_date       = newfollow_up.follow_date == RequestHelper.default_DateTime ? DateTime.Now : newfollow_up.follow_date;
                    newfollow_up.follow_isdelete   = "0";

                    if (!dic_Self[guid].Contains(newfollow_up))
                    {
                        //缓存添加客户
                        dic_Self[guid].Add(newfollow_up);

                        jsonModel = Constant.get_jsonmodel(0, "success", 1);
                        new Thread(() =>
                        {
                            try
                            {
                                //添加跟进
                                add_follow(guid, newfollow_up, _pictures);
                            }
                            catch (Exception ex)
                            {
                                LogHelper.Error(ex);
                            }
                        })
                        {
                            IsBackground = true
                        }.Start();
                    }
                }
            }
            catch (Exception ex)
            {
                jsonModel = Constant.ErrorGetData(ex);
            }
            finally
            {
                response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }