Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public void AddLinkmanDetail(Guid linkmanId, LinkmanDetail linkmanDetail)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(param_LinkmanId, SqlDbType.UniqueIdentifier).Value = linkmanId;
            cmd.Parameters.Add(param_DetailId, SqlDbType.UniqueIdentifier).Value  = linkmanDetail.Id;
            cmd.Parameters.Add(param_Type, SqlDbType.Int).Value = linkmanDetail.Type;

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

            cmd.Parameters.Add(param_IsDefault, SqlDbType.Bit).Value = linkmanDetail.IsDefault;

            SqlParameter sqlParam = new SqlParameter(param_ReturnValue, SqlDbType.Int);

            sqlParam.Direction = ParameterDirection.ReturnValue;
            cmd.Parameters.Add(sqlParam);

            SqlHelper.ExecuteNonQuery("InsertLinkmanDetail", cmd);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 显示联系人
        /// </summary>
        private void ShowDetail()
        {
            txtName.Text           = _currentLinkman.Name;
            ViewState["linkmanid"] = _currentLinkman.Id;

            LinkmanDetail temp = _currentLinkman.GetLinkmanDetailByType(InfoType.Num_Mobile);

            txtMobil.Text       = temp.Value;
            ViewState["mobile"] = temp.Id;

            temp              = _currentLinkman.GetLinkmanDetailByType(InfoType.Addr_Home);
            txtHome.Text      = temp.Value;
            ViewState["home"] = temp.Id;

            temp              = _currentLinkman.GetLinkmanDetailByType(InfoType.Addr_Work);
            txtOffice.Text    = temp.Value;
            ViewState["work"] = temp.Id;

            temp               = _currentLinkman.GetLinkmanDetailByType(InfoType.Addr_Email);
            txtEmail.Text      = temp.Value;
            ViewState["email"] = temp.Id;
        }
        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;
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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);
        }