Ejemplo n.º 1
0
        /// <summary>
        /// 解析出联系人信息
        /// </summary>
        /// <param name="vault"></param>
        /// <param name="lnkman"></param>
        /// <param name="oProperties"></param>
        private static void LinkmanInfo(Vault vault, Linkman lnkman, PropertyValues oProperties)
        {
            if (oProperties == null || oProperties.Count == 0)
            {
                return;
            }
            var propLinkmanName = MfAlias.GetPropDef(vault, "PropLinkmanName", true); //姓名
            var propEmail       = MfAlias.GetPropDef(vault, "PropEmail", true);       //邮箱
            var propInerUse     = MfAlias.GetPropDef(vault, "PropInnerUser", true);   //内部用户

            foreach (PropertyValue item in oProperties)
            {
                if (item.PropertyDef == propLinkmanName)
                {
                    lnkman.Name = item.TypedValue.DisplayValue;
                }

                if (item.PropertyDef == propEmail)
                {
                    lnkman.Mail = item.TypedValue.DisplayValue;
                }

                if (item.PropertyDef == propInerUse)
                {
                    lnkman.InnerUser = item.TypedValue.DisplayValue;
                }
            }
        }
Ejemplo n.º 2
0
        public Contact GetLinkman(string sysNo, int userId, int companyId, Guid linkmanId)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(param_LinkmanId, SqlDbType.UniqueIdentifier).Value = linkmanId;

            Contact contact = new Contact(sysNo, userId);
            Linkman linkman = null;

            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetLinkman", cmd))
            {
                while (sdr.Read())
                {
                    if (linkman == null)
                    {
                        linkman      = new Linkman(linkmanId);
                        linkman.Name = sdr[field_Name].ToString();

                        contact.Linkmans.Add(linkman);
                    }

                    if (sdr[field_DetailId] == DBNull.Value || sdr[field_DetailId] == null)
                    {
                        continue;
                    }

                    LinkmanDetail detail = new LinkmanDetail((Guid)sdr[field_DetailId], (InfoType)sdr[field_Type]);
                    detail.IsDefault = (bool)sdr[field_IsDefault];
                    detail.Value     = sdr[field_Value] == DBNull.Value ? null : sdr[field_Value].ToString();

                    linkman.Details.Add(detail);
                }
            }
            return(contact);
        }
Ejemplo n.º 3
0
        public void UpdateLinkmanDetailTest()
        {
            Linkman linkMan = InsertLinkManInfo();

            _LinkMan.Add(linkMan.Id);
            _LinkManDetail.Add(linkMan.Details[0].Id);
            _LinkManDetail.Add(linkMan.Details[1].Id);

            Contact UpdateMan = _IContactDA.GetLinkman("", 0, 0, linkMan.Id);

            Guid testDetailId1 = UpdateMan.Linkmans[0].Details[0].Id;
            Guid testDetailId2 = UpdateMan.Linkmans[0].Details[1].Id;

            UpdateMan.Linkmans[0].GetLinkmanDetailById(testDetailId1).Type  = InfoType.Addr_Email;
            UpdateMan.Linkmans[0].GetLinkmanDetailById(testDetailId1).Value = "*****@*****.**";
            UpdateMan.Linkmans[0].GetLinkmanDetailById(testDetailId2).Type  = InfoType.Addr_Home;
            UpdateMan.Linkmans[0].GetLinkmanDetailById(testDetailId2).Value = "34345678";

            _IContactDA.UpdateLinkman(UpdateMan.Linkmans[0]);

            Contact GetMan = _IContactDA.GetLinkman("", 0, 0, linkMan.Id);

            Assert.AreEqual(2, GetMan.Linkmans[0].Details.Count);
            Assert.AreEqual(UpdateMan.Linkmans[0].Details[0].Type,
                            GetMan.Linkmans[0].GetLinkmanDetailById(testDetailId1).Type);
            Assert.AreEqual(UpdateMan.Linkmans[0].Details[0].Value,
                            GetMan.Linkmans[0].GetLinkmanDetailById(testDetailId1).Value);
            Assert.AreEqual(UpdateMan.Linkmans[0].Details[1].Type,
                            GetMan.Linkmans[0].GetLinkmanDetailById(testDetailId2).Type);
            Assert.AreEqual(UpdateMan.Linkmans[0].Details[1].Value,
                            GetMan.Linkmans[0].GetLinkmanDetailById(testDetailId2).Value);
        }
Ejemplo n.º 4
0
        public void UpdateSomeContactTest1()
        {
            Contact testContact = CreateTestContact();

            contactServices.SaveLinkman(testContact.SysNo, testContact.UserId, testContact.Linkmans[1]);

            Guid testLinkmanId = testContact.Linkmans[1].Id;
            Guid testDetailId1 = testContact.Linkmans[1].Details[0].Id;
            Guid testDetailId2 = testContact.Linkmans[1].Details[1].Id;

            _LinkMans.Add(testContact.Linkmans[1]);

            Contact UpdataMan = contactServices.LoadAllContact(testContact.SysNo, testContact.UserId, true);

            UpdataMan.GetLinkmanById(testLinkmanId).Name = "wwweeewew333";

            UpdataMan.GetLinkmanById(testLinkmanId).GetLinkmanDetailById(testDetailId1).Type  = InfoType.Addr_Home;
            UpdataMan.GetLinkmanById(testLinkmanId).GetLinkmanDetailById(testDetailId1).Value = "东方路兰陵路2888号";
            UpdataMan.GetLinkmanById(testLinkmanId).GetLinkmanDetailById(testDetailId2).Type  = InfoType.Addr_Email;
            UpdataMan.GetLinkmanById(testLinkmanId).GetLinkmanDetailById(testDetailId2).Value = "*****@*****.**";
            contactServices.SaveLinkman(UpdataMan.SysNo, UpdataMan.UserId, UpdataMan.GetLinkmanById(testLinkmanId));
            Linkman getMan = contactServices.LoadAllContact(UpdataMan.SysNo, UpdataMan.UserId, true).GetLinkmanById(testLinkmanId);

            Assert.AreEqual(3, UpdataMan.GetLinkmanById(testLinkmanId).Details.Count);
            Assert.AreEqual("wwweeewew333", getMan.Name);
            Assert.AreEqual(InfoType.Addr_Home, getMan.GetLinkmanDetailById(testDetailId1).Type);
            Assert.AreEqual("东方路兰陵路2888号", getMan.GetLinkmanDetailById(testDetailId1).Value);
            Assert.AreEqual(InfoType.Addr_Email, getMan.GetLinkmanDetailById(testDetailId2).Type);
            Assert.AreEqual("*****@*****.**", getMan.GetLinkmanDetailById(testDetailId2).Value);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 得到所有联系人
        /// </summary>
        /// <param name="vault"></param>
        /// <param name="onlyIdAndTitle"></param>
        /// <returns></returns>
        public static IEnumerable <Linkman> GetLinkman(Vault vault, bool onlyIdAndTitle = false)
        {
            var linkman     = GetObjectClass(vault, "ClassEmailAddressBook");
            var sConditions = new SearchConditions();

            AddSearchBaseCondition(sConditions, linkman);
            var sResults = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(sConditions,
                                                                                       MFSearchFlags.MFSearchFlagNone, false, 0, 0);
            var lstLinkmans = new Collection <Linkman>();

            foreach (ObjectVersion objVn in sResults)
            {
                //lnkman.Name = objVn.Title;
                var lnkman = new Linkman {
                    Id = objVn.ObjVer.ID
                };

                if (!onlyIdAndTitle)
                {
                    var properties = vault.ObjectPropertyOperations.GetProperties(objVn.ObjVer, false);
                    LinkmanInfo(vault, lnkman, properties);
                }

                lstLinkmans.Add(lnkman);
            }
            return(lstLinkmans);
        }
Ejemplo n.º 6
0
        public void UpdateLinkman(Linkman linkman)
        {
            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Parameters.Add(param_LinkmanId, SqlDbType.UniqueIdentifier).Value = linkman.Id;
                cmd.Parameters.Add(param_Name, SqlDbType.NVarChar, 255).Value         = linkman.Name;
                if (String.IsNullOrEmpty(linkman.IndexKey))
                {
                    cmd.Parameters.Add(param_IndexKey, SqlDbType.Char, 1).Value = DBNull.Value;
                }
                else
                {
                    cmd.Parameters.Add(param_IndexKey, SqlDbType.Char, 1).Value = linkman.IndexKey;
                }

                SqlParameter sqlParam = new SqlParameter(param_ReturnValue, SqlDbType.Int);
                sqlParam.Direction = ParameterDirection.ReturnValue;
                cmd.Parameters.Add(sqlParam);

                if (linkman.Details != null)
                {
                    foreach (LinkmanDetail linkmanDetail in linkman.Details)
                    {
                        UpdateLinkmanDetail(linkmanDetail);
                    }
                }
                SqlHelper.ExecuteNonQuery("UpdateLinkman", cmd);
            }
            catch
            {
                throw new ApplicationException(_DbError);
            }
        }
Ejemplo n.º 7
0
 private void view_SaveLinkman(Linkman linkman)
 {
     try
     {
         _contactService.SaveLinkman(CompanyConfig.SYSTEMID, _view.UserId, 0, linkman);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 8
0
        //最近联系人:在发件箱中找邮件对象,从邮件对象中找出收件人,找出的前五个最近时间联系的人。

        /// <summary>
        /// 最近联系人(已发邮件中查找对象)
        /// </summary>
        /// <param name="vault">库</param>
        /// <param name="count">读取个数(索引0开始)</param>
        /// <returns></returns>
        public static List <Linkman> SearchSendmailObj(Vault vault, int count)
        {
            var lstLinkmans = new Collection <Linkman>();
            var lstTemp     = new List <Linkman>();
            var results     = new List <Linkman>();

            try
            {
                var prjMail     = GetObjectClass(vault, "ClassProjMail");//搜索项目邮件
                var sConditions = new SearchConditions();
                AddSearchBaseCondition(sConditions, prjMail, vault);
                var sResults = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(sConditions,
                                                                                           MFSearchFlags.MFSearchFlagNone, false, 0, 0);
                foreach (ObjectVersion item in sResults)//邮件
                {
                    var lnkman = new Linkman {
                        Id = item.ObjVer.ID
                    };
                    var properties = vault.ObjectPropertyOperations.GetProperties(item.ObjVer, false);
                    SendMailInfo(vault, lnkman, properties);

                    var mal = lnkman.Mail.Split(';');
                    foreach (var item2 in mal)
                    {
                        var tempLnkMan = new Linkman
                        {
                            Mail = item2.Trim()
                        };

                        if (!lstLinkmans.Contains(tempLnkMan))
                        {
                            lstLinkmans.Add(tempLnkMan);
                        }
                    }
                }

                lstTemp = lstLinkmans.OrderByDescending(i => i.Id).ToList();
                for (int i = 0; i < lstTemp.Count; i++)
                {
                    if (i > count)
                    {
                        break;
                    }
                    results.Add(lstTemp[i]);
                }
            }
            catch (Exception ex)
            {
                Common.Logger.Log.ErrorFormat("exception. search email from mfiles error: {0}", ex.Message);
            }

            return(results);
        }
Ejemplo n.º 9
0
        public void SaveLinkman(string sysNo, int userId, int companyId, Linkman linkman)
        {
            string msg;

            if (!Validation(linkman, out msg))
            {
                throw new Exception(msg);
            }

            _IContactDA.DeleteLinkman(linkman.Id);
            _IContactDA.AddLinkman(sysNo, userId, companyId, linkman);
        }
Ejemplo n.º 10
0
        public void DelteLinkmanTest1()
        {
            Linkman linkMan = new Linkman();

            linkMan.Name = "test";
            _IContactDA.AddLinkman("sss", 1, 0, linkMan);

            _LinkMan.Add(linkMan.Id);

            _IContactDA.DeleteLinkman(linkMan.Id);
            Contact GetMan = _IContactDA.GetLinkman("", 1, 0, linkMan.Id);

            Assert.AreEqual(0, GetMan.Linkmans.Count);
        }
Ejemplo n.º 11
0
        public void UpdateLinkmanTest1()
        {
            Linkman linkMan = new Linkman( );

            linkMan.Name = "test";
            _IContactDA.AddLinkman("sss", 1, 0, linkMan);
            linkMan.Name = "test1";

            _LinkMan.Add(linkMan.Id);

            _IContactDA.UpdateLinkman(linkMan);
            Contact GetMan = _IContactDA.GetLinkman("", 0, 0, linkMan.Id);

            Assert.AreEqual(1, GetMan.Linkmans.Count);
            Assert.AreEqual("test1", GetMan.Linkmans[0].Name);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 收集日志数据
        /// </summary>
        /// <returns></returns>
        private Linkman CompleteLogData()
        {
            Linkman link = new Linkman();

            link.Name = _View.LinkManName;
            LinkmanDetail temp;

            temp = new LinkmanDetail(InfoType.Num_Mobile, _View.MobileNo);
            link.Details.Add(temp);

            temp = new LinkmanDetail(InfoType.Addr_Home, _View.HomeNo);
            link.Details.Add(temp);
            temp = new LinkmanDetail(InfoType.Addr_Work, _View.OfficeNo);
            link.Details.Add(temp);
            temp = new LinkmanDetail(InfoType.Addr_Email, _View.EmailAddr);
            link.Details.Add(temp);
            return(link);
        }
Ejemplo n.º 13
0
        public void DeleteLinkmanDetailTest()
        {
            Linkman linkMan = InsertLinkManInfo();

            _LinkMan.Add(linkMan.Id);
            _LinkManDetail.Add(linkMan.Details[0].Id);
            _LinkManDetail.Add(linkMan.Details[1].Id);

            Guid DetailID = linkMan.Details[1].Id;

            _IContactDA.DeleteLinkmanDetail(linkMan.Details[0].Id);

            Contact GetMan = _IContactDA.GetLinkman("sss", 1, 0, linkMan.Id);

            Assert.AreEqual(1, GetMan.Linkmans[0].Details.Count);
            Assert.AreEqual(InfoType.Num_Fax, GetMan.Linkmans[0].GetLinkmanDetailById(DetailID).Type);
            Assert.AreEqual("2", GetMan.Linkmans[0].GetLinkmanDetailById(DetailID).Value);
        }
Ejemplo n.º 14
0
        public void UpdateSomeContactTest()
        {
            Contact testContact = CreateTestContact();

            contactServices.SaveLinkman(testContact.SysNo, testContact.UserId, testContact.Linkmans[0]);

            Guid testLinkmanId = testContact.Linkmans[0].Id;

            _LinkMans.Add(testContact.Linkmans[0]);

            Contact UpdataMan = contactServices.LoadAllContact(testContact.SysNo, testContact.UserId, false);

            UpdataMan.GetLinkmanById(testLinkmanId).Name = "TestSystem";
            contactServices.SaveLinkman(UpdataMan.SysNo, UpdataMan.UserId, UpdataMan.GetLinkmanById(testLinkmanId));
            Linkman getMan = contactServices.LoadAllContact(UpdataMan.SysNo, UpdataMan.UserId, false).GetLinkmanById(testLinkmanId);

            Assert.AreEqual(0, UpdataMan.GetLinkmanById(testLinkmanId).Details.Count);
            Assert.AreEqual("TestSystem", getMan.Name);
        }
Ejemplo n.º 15
0
        public Linkman InsertLinkManInfo()
        {
            Contact contactMan = new Contact("aaa", 1);

            Linkman linkman = new Linkman();

            linkman.Name = "link";

            LinkmanDetail Detail1 = new LinkmanDetail(InfoType.Num_General);
            LinkmanDetail Detail2 = new LinkmanDetail(InfoType.Num_Fax, "2");

            linkman.Details.Add(Detail1);
            linkman.Details.Add(Detail2);

            contactMan.Linkmans.Add(linkman);

            _IContactDA.AddLinkman(contactMan.SysNo, contactMan.UserId, 0, linkman);

            return(linkman);
        }
Ejemplo n.º 16
0
        public void AddLinkmanTest1()

        {
            Linkman linkman = new Linkman();

            linkman.Name = "毛毛";
            string sysNo  = "iiuii";
            int    userId = 1;

            _IContactDA.AddLinkman(sysNo, userId, 0, linkman);

            _LinkMan.Add(linkman.Id);

            Contact contact = _IContactDA.GetLinkman(sysNo, userId, 0, linkman.Id);

            Assert.AreEqual(1, contact.Linkmans.Count);
            Assert.AreEqual(linkman.Id, contact.Linkmans[0].Id);
            Assert.AreEqual(linkman.Name, contact.Linkmans[0].Name);
            Assert.AreEqual(sysNo, contact.SysNo);
            Assert.AreEqual(userId, contact.UserId);
        }
Ejemplo n.º 17
0
        private Contact CreateTestContact()
        {
            Contact testContact = new Contact("TestSys", 1);

            Linkman linkman1 = new Linkman();

            linkman1.Name = "linkman1";
            linkman1.Details.Add(new LinkmanDetail(InfoType.Num_General, "123456"));
            linkman1.Details.Add(new LinkmanDetail(InfoType.Num_Mobile, "13676548657"));

            Linkman linkman2 = new Linkman();

            linkman2.Name = "linkman2";
            linkman2.Details.Add(new LinkmanDetail(InfoType.Addr_Email, "*****@*****.**"));
            linkman2.Details.Add(new LinkmanDetail(InfoType.Num_Work, "02176548657"));

            testContact.Linkmans.Add(linkman1);
            testContact.Linkmans.Add(linkman2);

            return(testContact);
        }
Ejemplo n.º 18
0
        private static Contact CreateTestContact()
        {
            Contact testContact = new Contact("TestSys", 1);

            Linkman linkman1 = new Linkman();

            linkman1.Name = "linkman1";
            linkman1.Details.Add(new LinkmanDetail(InfoType.Num_General, "123456"));
            linkman1.Details.Add(new LinkmanDetail(InfoType.Num_Mobile, "13676548657"));

            Linkman linkman2 = new Linkman();

            linkman2.Name = "linkman2";
            linkman2.Details.Add(new LinkmanDetail(InfoType.Addr_Email, "*****@*****.**"));
            linkman2.Details.Add(new LinkmanDetail(InfoType.Num_Work, "02176548657"));
            linkman2.Details.Add(new LinkmanDetail(InfoType.Addr_Web, "http://www.126.blog/login.aspx"));

            testContact.Linkmans.Add(linkman1);
            testContact.Linkmans.Add(linkman2);

            return(testContact);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 解析:发送邮件信息
        /// </summary>
        private static void SendMailInfo(Vault vault, Linkman lnkman, PropertyValues oProperties)
        {
            if (oProperties == null || oProperties.Count == 0)
            {
                return;
            }
            var propMailReceiver = MfAlias.GetPropDef(vault, "PropMailReceiver", true); //收件人
            var propMailCc       = MfAlias.GetPropDef(vault, "PropMailCc", true);       //抄送

            foreach (PropertyValue item in oProperties)
            {
                if (item.PropertyDef == propMailReceiver)
                {
                    lnkman.Mail = item.TypedValue.DisplayValue;
                }

                if (item.PropertyDef == propMailCc)
                {
                    lnkman.Cc = item.TypedValue.DisplayValue;
                }
            }
        }
Ejemplo n.º 20
0
        public void AddLinkman(string sysNo, int userId, int companyId, Linkman linkman)
        {
            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Parameters.Add(param_SysNo, SqlDbType.NVarChar, 255).Value        = sysNo;
                cmd.Parameters.Add(param_UserId, SqlDbType.Int).Value                 = userId;
                cmd.Parameters.Add(param_ComapnyId, SqlDbType.Int).Value              = companyId;
                cmd.Parameters.Add(param_LinkmanId, SqlDbType.UniqueIdentifier).Value = linkman.Id;
                cmd.Parameters.Add(param_Name, SqlDbType.NVarChar, 255).Value         = linkman.Name;
                if (String.IsNullOrEmpty(linkman.IndexKey))
                {
                    cmd.Parameters.Add(param_IndexKey, SqlDbType.Char, 1).Value = DBNull.Value;
                }
                else
                {
                    cmd.Parameters.Add(param_IndexKey, SqlDbType.Char, 1).Value = linkman.IndexKey;
                }

                SqlParameter sqlParam = new SqlParameter(param_ReturnValue, SqlDbType.Int);
                sqlParam.Direction = ParameterDirection.ReturnValue;
                cmd.Parameters.Add(sqlParam);

                if (linkman.Details.Count > 0)
                {
                    foreach (LinkmanDetail linkmanDetail in linkman.Details)
                    {
                        AddLinkmanDetail(linkman.Id, linkmanDetail);
                    }
                }
                SqlHelper.ExecuteNonQuery("InsertLinkman", cmd);
            }
            catch
            {
                throw new ApplicationException(_DbError);
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 获取联系人
        /// </summary>
        private void Refresh()
        {
            _currentLinkman      = new Linkman((Guid)ViewState["linkmanid"]);
            _currentLinkman.Name = txtName.Text.Trim();

            LinkmanDetail temp;

            temp       = new LinkmanDetail((Guid)ViewState["mobile"], InfoType.Num_Mobile);
            temp.Value = txtMobil.Text.Trim();
            _currentLinkman.Details.Add(temp);


            temp       = new LinkmanDetail((Guid)ViewState["home"], InfoType.Addr_Home);
            temp.Value = txtHome.Text.Trim();
            _currentLinkman.Details.Add(temp);

            temp       = new LinkmanDetail((Guid)ViewState["work"], InfoType.Addr_Work);
            temp.Value = txtOffice.Text.Trim();
            _currentLinkman.Details.Add(temp);

            temp       = new LinkmanDetail((Guid)ViewState["email"], InfoType.Addr_Email);
            temp.Value = txtEmail.Text.Trim();
            _currentLinkman.Details.Add(temp);
        }
        public void DataBind(Guid guid)
        {
            //获取登录员工公司id
            int     companyId = _IEmployeeFacade.GetEmployeeByAccountID(LoginUser.Id).EmployeeDetails.Work.Company.DepartmentID;
            Linkman linkman   = _contactService.LoadSomeContactByName(CompanyConfig.SYSTEMID, 0, companyId, string.Empty).GetLinkmanById(guid);

            _View.LinkManId   = linkman.Id;
            _View.LinkManName = linkman.Name;
            LinkmanDetail temp = linkman.GetLinkmanDetailByType(InfoType.Num_Mobile);

            _View.MobileNo = temp.Value;

            temp         = linkman.GetLinkmanDetailByType(InfoType.Addr_Home);
            _View.HomeNo = temp.Value;
            //ViewState["home"] = temp.Id;

            temp           = linkman.GetLinkmanDetailByType(InfoType.Addr_Work);
            _View.OfficeNo = temp.Value;
            //ViewState["work"] = temp.Id;

            temp            = linkman.GetLinkmanDetailByType(InfoType.Addr_Email);
            _View.EmailAddr = temp.Value;
            //ViewState["email"] = temp.Id;
        }
Ejemplo n.º 23
0
        private Contact GetLinkmansByCondition(string sysNo, int userId, string name, string indexKey, int companyId, bool isExternal)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(param_SysNo, SqlDbType.NVarChar, 255).Value = sysNo;
            cmd.Parameters.Add(param_UserId, SqlDbType.Int).Value          = userId;
            cmd.Parameters.Add(param_ComapnyId, SqlDbType.Int).Value       = companyId;
            cmd.Parameters.Add(param_IsExternal, SqlDbType.Bit).Value      = isExternal;

            if (String.IsNullOrEmpty(name))
            {
                cmd.Parameters.Add(param_Name, SqlDbType.NVarChar, 255).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(param_Name, SqlDbType.NVarChar, 255).Value = name;
            }

            if (String.IsNullOrEmpty(indexKey))
            {
                cmd.Parameters.Add(param_IndexKey, SqlDbType.Char, 1).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(param_IndexKey, SqlDbType.Char, 1).Value = indexKey;
            }

            Contact contact = new Contact(sysNo, userId);

            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetLinkmansByCondition", cmd))
            {
                while (sdr.Read())
                {
                    Guid    linkmanId = (Guid)sdr[field_LinkmanId];
                    Linkman linkman;

                    if (!contact.Contains(linkmanId))
                    {
                        linkman = new Linkman(linkmanId);
                        contact.Linkmans.Add(linkman);
                    }
                    else
                    {
                        linkman = contact.GetLinkmanById(linkmanId);
                    }

                    linkman.Name = sdr[field_Name].ToString();

                    if (!isExternal)
                    {
                        continue;
                    }

                    if (sdr[field_DetailId] == DBNull.Value || sdr[field_DetailId] == null)
                    {
                        continue;
                    }

                    LinkmanDetail detail = new LinkmanDetail((Guid)sdr[field_DetailId], (InfoType)sdr[field_Type]);
                    detail.IsDefault = (bool)sdr[field_IsDefault];
                    detail.Value     = sdr[field_Value].ToString();

                    linkman.Details.Add(detail);
                }
            }
            return(contact);
        }
Ejemplo n.º 24
0
        private bool Validation(Linkman linkman, out string msg)
        {
            bool temp = true;

            msg = String.Empty;
            StringBuilder sb = new StringBuilder();

            if (String.IsNullOrEmpty(linkman.Name) || String.IsNullOrEmpty(linkman.Name.Trim()) ||
                (!Tools.IsAz(linkman.Name.Trim()[0].ToString()) &&
                 !Tools.IsCHS(linkman.Name.Trim()[0].ToString())))
            {
                sb.AppendLine("联系人姓名必须以字母或汉字开头:(" + linkman.Name + ");");
                temp = false;
            }

            if (linkman.Details.Count <= 0)
            {
                msg = sb.ToString();
                return(temp);
            }

            foreach (LinkmanDetail ld in linkman.Details)
            {
                switch (ld.Type)
                {
                case InfoType.Num_Fax:
                case InfoType.Num_General:
                case InfoType.Num_Home:
                case InfoType.Num_Mobile:
                case InfoType.Num_Work:
                {
                    if (!String.IsNullOrEmpty(ld.Value) &&
                        !String.IsNullOrEmpty(ld.Value.Trim()) &&
                        !Tools.IsPhoneNum(ld.Value.Trim()))
                    {
                        sb.AppendLine("电话号码不合法!");
                        temp = false;
                    }
                }
                break;

                case InfoType.Addr_Email:
                {
                    if (!String.IsNullOrEmpty(ld.Value) &&
                        !String.IsNullOrEmpty(ld.Value.Trim()) &&
                        !Tools.IsEmail(ld.Value.Trim()))
                    {
                        sb.AppendLine("Email地址不合法!");
                        temp = false;
                    }
                }
                break;

                case InfoType.Addr_Web:
                {
                    if (!String.IsNullOrEmpty(ld.Value) &&
                        !String.IsNullOrEmpty(ld.Value.Trim()) &&
                        !Tools.IsURL(ld.Value.Trim()))
                    {
                        sb.AppendLine("个人主页地址不合法!");
                        temp = false;
                    }
                }
                break;

                default:
                    break;
                }
            }
            msg = sb.ToString();
            return(temp);
        }
 public CustomerLinkmanAddedDomainEvent(Entities.Customer customer, Linkman linkman)
 {
     Customer = customer;
     Linkman  = linkman;
 }
Ejemplo n.º 26
0
 public void SaveLinkman(string sysNo, int userId, int companyId, Linkman linkman)
 {
     _IContact.SaveLinkman(sysNo, userId, companyId, linkman);
 }
Ejemplo n.º 27
0
        /// <summary>
        /// 修改联系人
        /// </summary>
        protected void Update_Command(Linkman linkman)
        {
            LinkmanView1.CurrentLinkman = linkman;

            IsDisplayDetail = true;
        }