示例#1
0
        public static bool InsertListNumber(Guid userGuid,
                                            Guid phoneBookGuid,
                                            ref List <string> lstNumbers,
                                            ref List <string> lstFailedNumbers,
                                            ref int countNumberDuplicate,
                                            Business.CheckNumberScope scope)
        {
            Business.PhoneNumber phoneNumberController = new Business.PhoneNumber();
            int mobileCount = 0;
            int emailCount  = 0;

            try
            {
                Outbox.GetCountNumberOfOperators(ref lstNumbers, ref lstFailedNumbers);

                if (lstNumbers.Count == 0)
                {
                    throw new Exception(Language.GetString("CompleteMobileNoField"));
                }

                Common.User user = User.LoadUser(userGuid);
                PhoneBook.GetUserMaximumRecordInfo(userGuid, ref mobileCount, ref emailCount);

                if (user.MaximumPhoneNumber != -1 &&
                    user.MaximumPhoneNumber <= mobileCount &&
                    user.MaximumPhoneNumber <= (mobileCount + lstNumbers.Count))
                {
                    throw new Exception(Language.GetString("ErrorMaximumPhoneNumber"));
                }

                XDocument doc  = new XDocument();
                XElement  root = new XElement("NewDataSet");

                foreach (string number in lstNumbers)
                {
                    XElement element = new XElement("Table");
                    element.Add(new XElement("CellPhone", number));
                    root.Add(element);
                }
                doc.Add(root);

                return(phoneNumberController.InsertListNumber(userGuid, phoneBookGuid, doc.ToString(), ref countNumberDuplicate, scope));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public static bool InsertListEmail(Guid userGuid, Guid phoneBookGuid, ref List <string> lstEmails, ref List <string> lstFailedEmails,
                                           ref int countEmailDuplicate, Business.CheckEmailScope scope)
        {
            Business.PhoneNumber phoneNumberController = new Business.PhoneNumber();
            int mobileCount = 0;
            int emailCount  = 0;

            try
            {
                Helper.CheckEmailsList(ref lstEmails, ref lstFailedEmails);

                Common.User user = Facade.User.LoadUser(userGuid);
                PhoneBook.GetUserMaximumRecordInfo(userGuid, ref mobileCount, ref emailCount);

                if (user.MaximumEmailAddress != -1 && user.MaximumEmailAddress <= emailCount && user.MaximumEmailAddress <= (emailCount + lstEmails.Count))
                {
                    throw new Exception(Language.GetString("ErrorMaximumEmailAddress"));
                }


                XDocument doc  = new XDocument();
                XElement  root = new XElement("NewDataSet");

                foreach (string number in lstEmails)
                {
                    XElement element = new XElement("Table");

                    element.Add(new XElement("Email", number));
                    root.Add(element);
                }
                doc.Add(root);

                return(phoneNumberController.InsertEmailAddress(userGuid, phoneBookGuid, doc.ToString(), ref countEmailDuplicate, scope));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }