Exemple #1
0
        public kfContact GetContact(string client)
        {
            kfContact      contact = new kfContact();
            List <Contact> result  = new List <Contact>();
            string         cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;
            string         session = Session.SessionID.ToString();

            if (!cookies.Equals(session))
            {
                return(null);
            }
            MLogin.GetExeUname();
            string kf_code   = string.Empty;
            string tablename = string.Empty;

            #region
            //string kf_tb = string.Empty;
            //kfku m = new kfku();
            //List<kfku> ms = m.Select(" and NAME='" + client + "'  order by id desc  ");
            //if (ms.Count > 0)
            //{
            //    kf_code = ms[0].CODE;
            //    //kf_tb = "kfku";
            //    tablename = "kfku_contacter";
            //}
            //else
            //{
            #endregion
            ClientService_kfku        k  = new ClientService_kfku();
            List <ClientService_kfku> ks = k.Select(" and NAME='" + client + "'   order by id desc   ");
            if (ks.Count > 0)
            {
                kf_code   = ks[0].CODE;
                tablename = "clientservice_kfku_contacter";
            }
            if (kf_code == "" || tablename == "")//
            {
                return(null);
            }
            else
            {
                string    sql = " select * from  " + tablename + "  where 单位代码=" + kf_code.ToString();
                DataTable dt  = DBLL.ExecuteDataTable(MyGlobal.DataBase, sql);
                foreach (DataRow row in dt.Rows)
                {
                    Contact con = new Contact();
                    con.id       = row["ID"].ToString();
                    con.name     = row["姓名"].ToString();
                    con.phone    = row["手机"].ToString();
                    con.position = row["职务"].ToString();
                    result.Add(con);
                }
                contact.list      = result;
                contact.tablename = tablename;
                contact.kfcode    = kf_code;
            }
            return(contact);
        }
Exemple #2
0
        public bool NewContact(string kfcode, string tablename, string name, string position, string phone)
        {
            bool           flag    = true;
            kfContact      contact = new kfContact();
            List <Contact> result  = new List <Contact>();
            string         cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;
            string         session = Session.SessionID.ToString();

            if (!cookies.Equals(session))
            {
                flag = false;
                return(flag);
            }
            MLogin.GetExeUname();
            try
            {
                //if (tablename == "kfku_contacter")
                //{
                //    kfku_contacter k = new kfku_contacter();
                //    k.姓名 = name;
                //    k.单位代码 = kfcode;
                //    k.手机 = phone;
                //    k.职务 = position;
                //    k.Insert();
                //}
                //else
                //{
                clientservice_kfku_contacter m = new clientservice_kfku_contacter();
                m.姓名   = name;
                m.单位代码 = kfcode;
                m.手机   = phone;
                m.职务   = position;
                m.Insert();
                //}
            }
            catch
            {
                //除非try里面执行代码发生了异常,否则这里的代码不会执行
                flag = false;
            }
            return(flag);
        }