示例#1
0
        /// <summary>
        /// Starts a Chrome Mobile Emuation driver
        /// </summary>
        /// <param name="phoneType">The type of device to emulate</param>
        /// <param name="touch">Whether to respond to toucn events</param>
        /// <returns>An instance of the Chrome Driver set to emulate a particular device</returns>
        public IWebDriver StartMobileDriver(EnumPhoneType phoneType, bool touch)
        {
            try
            {
                SetOptions();
                PhoneTypes.TryGetValue(phoneType, out string phoneName);
                Options.EnableMobileEmulation(phoneName);
                SetMobileDriverService();
                AddAdditionalCapabilities();
                Driver = new ChromeDriver(Service, Options, BaseSettings.Timeout);
                return(Driver);
            }
            catch (Exception ex)
            {
                switch (BaseSettings.DebugLevel)
                {
                case EnumConsoleDebugLevel.Human:
                    Console.Out.WriteLine("Could not start the chrome driver's mobile emulation functionality.");
                    Console.Out.WriteLine("Please investigate the changes you have made to your config file.");
                    break;

                case EnumConsoleDebugLevel.NotSpecified:
                case EnumConsoleDebugLevel.Message:
                    Console.Out.WriteLine(ex.Message);
                    break;

                case EnumConsoleDebugLevel.StackTrace:
                    Console.Out.WriteLine(ex.Message);
                    Console.Out.WriteLine(ex.StackTrace);
                    break;
                }
                return(null);
            }
        }
示例#2
0
        /// <summary>
        ///     Looks for the first phone of the specified type that is a preferred phone.
        /// </summary>
        /// <param name="phoneType">
        ///     The type of phone to seek.
        /// </param>
        /// <returns>
        ///     The first <see cref="Phone " /> that matches the specified type. A preferred number is returned
        ///     before a non-preferred number.
        /// </returns>
        public Phone GetFirstChoice(PhoneTypes phoneType)
        {
            Phone firstNonPreferred = null;

            foreach (var phone in this)
            {
                if ((phone.PhoneType & phoneType) == phoneType)
                {
                    // This phone has the same phone type as
                    // specified by the caller.  Save a reference
                    // to the first such phone encountered.

                    if (firstNonPreferred == null)
                    {
                        firstNonPreferred = phone;
                    }

                    if (phone.PhoneType == PhoneTypes.Preferred)
                    {
                        return(phone);
                    }
                }
            }

            // No phone had the specified phone type and was marked
            // as preferred.

            return(firstNonPreferred);
        }
示例#3
0
        //=====================================================================

        /// <summary>
        /// This is used to set the checked state of an address type checkbox
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void CheckBox_Format(object sender, ConvertEventArgs e)
        {
            CheckBox   cb        = (CheckBox)((Binding)sender).Control;
            PhoneTypes checkType = (PhoneTypes)cb.Tag;
            PhoneTypes addrTypes = (PhoneTypes)e.Value;

            e.Value = (addrTypes & checkType) == checkType;
        }
        public static string GetPhoneType(RestCommand command, int phoneTypeID)
        {
            PhoneType phoneType = PhoneTypes.GetPhoneType(command.LoginUser, phoneTypeID);

            if (phoneType.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(phoneType.GetXml("PhoneType", true));
        }
示例#5
0
 /**
  * @param validSince
  *            `validSince` is a <code>DateTime</code> object, it's the first
  *            time Pipl's crawlers found this data on the page.
  * @param countryCode
  *            countryCode
  * @param number
  *            number
  * @param extension
  *            extension
  * @param type
  *            type is one of "mobile", "home_phone", "home_fax",
  *            "work_phone" , "pager".
  * @param raw
  *            `raw` is an unparsed phone
  */
 public Phone(int? countryCode = null, long? number = null, int? extension = null,
         PhoneTypes? type = null, string raw = null, DateTime? validSince = null)
     : base(validSince)
 {
     this.CountryCode = countryCode;
     this.Number = number;
     this.Extension = extension;
     this.Type = type;
     this.Raw = raw;
 }
示例#6
0
        /// <summary>
        /// Add a <see cref="TelephoneProperty"/> to the collection and assign it the specified value and type(s)
        /// </summary>
        /// <param name="phoneTypes">The telephone types to assign to the new property</param>
        /// <param name="phone">The phone number value to assign to the new property</param>
        /// <returns>Returns the new property that was created and added to the collection</returns>
        public TelephoneProperty Add(PhoneTypes phoneTypes, string phone)
        {
            TelephoneProperty t = new TelephoneProperty {
                PhoneTypes = phoneTypes, Value = phone
            };

            base.Add(t);

            return(t);
        }
        /// <summary>
        /// Add a <see cref="TelephoneProperty"/> to the collection and assign it the specified value and type(s)
        /// </summary>
        /// <param name="phoneTypes">The telephone types to assign to the new property</param>
        /// <param name="phone">The phone number value to assign to the new property</param>
        /// <returns>Returns the new property that was created and added to the collection</returns>
        public TelephoneProperty Add(PhoneTypes phoneTypes, string phone)
        {
            TelephoneProperty t = new TelephoneProperty();

            t.PhoneTypes = phoneTypes;
            t.Value      = phone;
            base.Add(t);

            return(t);
        }
    private void LoadPhoneTypes()
    {
        cmbTypes.Items.Clear();
        PhoneTypes phoneTypes = new PhoneTypes(UserSession.LoginUser);

        phoneTypes.LoadByOrganizationID(UserSession.LoginUser.OrganizationID);
        foreach (PhoneType phoneType in phoneTypes)
        {
            cmbTypes.Items.Add(new RadComboBoxItem(phoneType.Name, phoneType.PhoneTypeID.ToString()));
        }
    }
示例#9
0
        public string UpdatePhone(int phoneID, string phone, PhoneTypes type, string notes)
        {
            var p = db.Phones.Find(phoneID);

            p.number          = phone;
            p.type            = (int)type;
            p.notes           = notes;
            db.Entry(p).State = EntityState.Modified;
            db.SaveChanges();

            return("Numero actualizado correctamente");
        }
示例#10
0
        /// <summary>
        /// This is overridden to provide custom handling of the TYPE parameter
        /// </summary>
        /// <param name="sb">The StringBuilder to which the parameters are appended</param>
        public override void SerializeParameters(StringBuilder sb)
        {
            base.SerializeParameters(sb);

            PhoneTypes pt = this.PhoneTypes;

            // Serialize the phone types if necessary
            if (pt != PhoneTypes.None && pt != PhoneTypes.Voice)
            {
                // PCS is only defined in the 3.0 spec
                if (this.Version != SpecificationVersions.vCard30)
                {
                    pt &= ~PhoneTypes.PCS;
                }

                // Text and TextPhone are only defined in the 4.0 spec
                if (this.Version != SpecificationVersions.vCard40)
                {
                    pt &= ~(PhoneTypes.Text | PhoneTypes.TextPhone);
                }

                StringBuilder sbTypes = new StringBuilder(50);

                // This ignores the last entry (MOBILE) as it's a duplicate of CELL
                for (int idx = 1; idx < ntv.Length - 1; idx++)
                {
                    if ((pt & ntv[idx].EnumValue) != 0)
                    {
                        if (sbTypes.Length > 0)
                        {
                            sbTypes.Append(',');
                        }

                        sbTypes.Append(ntv[idx].Name);
                    }
                }

                // The format is different for the 3.0 spec and later
                if (this.Version == SpecificationVersions.vCard21)
                {
                    sbTypes.Replace(',', ';');
                }
                else
                {
                    sbTypes.Insert(0, "=");
                    sbTypes.Insert(0, ParameterNames.Type);
                }

                sb.Append(';');
                sb.Append(sbTypes.ToString());
            }
        }
示例#11
0
        public static string GetPhoneTypes(RestCommand command, bool orderByDateCreated = false)
        {
            PhoneTypes items = new PhoneTypes(command.LoginUser);

            if (orderByDateCreated)
            {
                items.LoadByOrganizationID(command.Organization.OrganizationID, "DateCreated DESC");
            }
            else
            {
                items.LoadByOrganizationID(command.Organization.OrganizationID);
            }
            return(items.GetXml("PhoneTypes", "PhoneType", true, command.Filters));
        }
        public static string GetPhoneTypes(RestCommand command)
        {
            PhoneTypes phoneTypes = new PhoneTypes(command.LoginUser);

            phoneTypes.LoadByOrganizationID(command.Organization.OrganizationID);

            if (command.Format == RestFormat.XML)
            {
                return(phoneTypes.GetXml("PhoneTypes", "PhoneType", true, command.Filters));
            }
            else
            {
                throw new RestException(HttpStatusCode.BadRequest, "Invalid data format");
            }
        }
示例#13
0
        private void LoadCustomProperty()
        {
            switch (_refType)
            {
            case ReferenceType.ActionTypes:
                ActionType actionType = (ActionType)ActionTypes.GetActionType(LoginSession.LoginUser, _id);
                textDescription.Text = actionType.Description;
                textName.Text        = actionType.Name;
                break;

            case ReferenceType.PhoneTypes:
                PhoneType phoneType = (PhoneType)PhoneTypes.GetPhoneType(LoginSession.LoginUser, _id);
                textDescription.Text = phoneType.Description;
                textName.Text        = phoneType.Name;
                break;

            case ReferenceType.ProductVersionStatuses:
                ProductVersionStatus productVersionStatus = (ProductVersionStatus)ProductVersionStatuses.GetProductVersionStatus(LoginSession.LoginUser, _id);
                textDescription.Text   = productVersionStatus.Description;
                textName.Text          = productVersionStatus.Name;
                cbDiscontinued.Checked = productVersionStatus.IsDiscontinued;
                cbShipping.Checked     = productVersionStatus.IsShipping;
                break;

            case ReferenceType.TicketSeverities:
                TicketSeverity ticketSeverity = (TicketSeverity)TicketSeverities.GetTicketSeverity(LoginSession.LoginUser, _id);
                textDescription.Text = ticketSeverity.Description;
                textName.Text        = ticketSeverity.Name;
                break;

            case ReferenceType.TicketStatuses:
                TicketStatus ticketStatus = (TicketStatus)TicketStatuses.GetTicketStatus(LoginSession.LoginUser, _id);
                textDescription.Text = ticketStatus.Description;
                textName.Text        = ticketStatus.Name;
                cbClosed.Checked     = ticketStatus.IsClosed;
                break;

            default:
                break;
            }
        }
示例#14
0
        /// <summary>
        /// Método utilitario utilizado para registrar un nuevo teléfono en la
        /// base de datos.
        /// </summary>
        /// <param name="entityID">Id de entidad dueña del teléfono.</param>
        /// <param name="isUser">valro booleano que indica si es un usuario.</param>
        /// <param name="phoneE">número teléfonico.</param>
        /// <param name="type">tipo de teléfono.</param>
        /// <param name="notes">observaciones para este número telefónico.</param>
        /// <returns>un mensaje indicando que el teléfono ha sido registrado.</returns>
        public string AddPhone(int entityID, bool isUser, string phoneE, PhoneTypes type, string notes)
        {
            Phone number = new Phone();

            number.number = phoneE;
            number.type   = (int)type;
            number.notes  = notes;
            if (isUser)
            {
                var user = db.Users.Find(entityID);
                user.Phones.Add(number);
            }
            else
            {
                var insurer = db.Insurers.Find(entityID);
                insurer.Phones.Add(number);
            }
            db.SaveChanges();

            return(_("lblPhoneAdded"));
        }
示例#15
0
        /// <summary>
        /// This is used to store the value of the address type checkbox
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void CheckBox_Parse(object sender, ConvertEventArgs e)
        {
            TelephoneProperty t         = (TelephoneProperty)this.BindingSource.Current;
            CheckBox          cb        = (CheckBox)((Binding)sender).Control;
            PhoneTypes        checkType = (PhoneTypes)cb.Tag;

            if (cb.Checked)
            {
                t.PhoneTypes |= checkType;
            }
            else
            {
                t.PhoneTypes &= ~checkType;
            }

            // Only one address can be the preferred address
            if (checkType == PhoneTypes.Preferred)
            {
                ((TelephonePropertyCollection)this.BindingSource.DataSource).SetPreferred(t);
            }
        }
示例#16
0
        /// <summary>
        /// This method can be used to find the first phone number that has one of the specified phone types
        /// </summary>
        /// <param name="phoneType">The phone type to match</param>
        /// <returns>The first phone number with a phone type matching one of those specified or null if not found</returns>
        /// <remarks>Multiple phone types can be specified.  Including <c>Preferred</c> will limit the match to
        /// the one with the <c>Preferred</c> flag set.  If a preferred phone number with one of the given types
        /// cannot be found, it will return the first phone number matching one of the given types without the
        /// <c>Preferred</c> flag set.  If no phone number can be found, it returns null.</remarks>
        public TelephoneProperty FindFirstByType(PhoneTypes phoneType)
        {
            PhoneTypes phoneNoPref  = phoneType & ~PhoneTypes.Preferred;
            bool       usePreferred = (phoneNoPref != phoneType);

            foreach (TelephoneProperty phone in this)
            {
                if ((phone.PhoneTypes & phoneNoPref) != 0 && (!usePreferred ||
                                                              (phone.PhoneTypes & PhoneTypes.Preferred) != 0))
                {
                    return(phone);
                }
            }

            // Try again without the preferred flag?
            if (usePreferred)
            {
                return(this.FindFirstByType(phoneNoPref));
            }

            return(null);
        }
示例#17
0
    void Awake()
    {
        if (CurrentCharacterType == CharacterType.Marlon)
            NumberOfSections = 7.0f;
        else if (CurrentCharacterType == CharacterType.Isaac)
            NumberOfSections = 5.0f;
        else if (CurrentCharacterType == CharacterType.Felix)
            NumberOfSections = 9.0f;

        #region DeviceResolution
        if (CurrentPhoneType == PhoneTypes.UNIDENTIFIED && Camera.main != null) {
            float currentAspect = Camera.main.aspect;

            //Galaxy S7
            if (currentAspect == 1440f / 2560f) {
                CurrentPhoneType = PhoneTypes.GALAXYS7;
            }
            //iPhone6
            if (currentAspect == 750 / 1334) {
                CurrentPhoneType = PhoneTypes.IPHONE6;
            }
            //iPhone5
            if (currentAspect == 640 / 1136) {
                CurrentPhoneType = PhoneTypes.IPHONE5;
            }
            //iPhone4
            if (currentAspect == 640 / 960) {
                CurrentPhoneType = PhoneTypes.IPHONE4;
            }
        }
        #endregion

        //Mason: Temp solution to test transition between phone and game scenes without character select. If you are seeing this, please feel free to remove.
        //Ashlyn: This is ok, just comment stuff like this out before making commits.
        //CurrentCharacterType = CharacterType.Marlon;
        //CurrentConvoIndex = 0;
        //CurrentCharacterConvo = CharacterConvo.Mom;

        /*TransitionScreen.SetActive (true);
        TransitionScreen.GetComponent<CanvasGroup> ().alpha = 1f;*/

        if (SceneManager.GetActiveScene ().name == "Prioritizing")
        {
            GameObject instructions = Instantiate (CollectDiamond, new Vector3 (Camera.main.transform.position.x, Camera.main.transform.position.y, 1), Quaternion.identity) as GameObject;
            _currentInstructions = instructions.GetComponent<SpriteRenderer> ();

            if (CurrentCharacterType == CharacterType.Felix) {
                if (CurrentConvoIndex == 1) {
                    FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 1-1");
                }
                if (CurrentConvoIndex == 2) {
                    FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 2-1");
                }
                if (CurrentConvoIndex == 3) {
                    FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 3-1");
                }
            }
            if (CurrentCharacterType == CharacterType.Marlon) {
                if (CurrentConvoIndex == 5) {
                    FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 1-1");
                } else if (CurrentConvoIndex == 6) {
                    FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 3-1");
                }
            }
        }
        if (SceneManager.GetActiveScene ().name == "RoomEscape") {
            GameObject instructions = Instantiate (GetBone, new Vector3 (Camera.main.transform.position.x, Camera.main.transform.position.y, 1), Quaternion.identity) as GameObject;
            _currentInstructions = instructions.GetComponent<SpriteRenderer> ();
            GameObject currentRELevel = null;

            if (CurrentCharacterType == CharacterType.Marlon) {
                if (CurrentConvoIndex == 0)
                    currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 1);
                else if (CurrentConvoIndex == 1)
                    currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 3);
                else if (CurrentConvoIndex == 2)
                    currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 4);
            }
            if (CurrentCharacterType == CharacterType.Isaac) {
                if (CurrentConvoIndex == 0)
                    currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 3);
                else if (CurrentConvoIndex == 1)
                    currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 4);
                else if (CurrentConvoIndex == 2)
                    currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 1);
            }
            if (CurrentCharacterType == CharacterType.Felix) {
                if (CurrentConvoIndex == 4)
                    currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 5);
                else if (CurrentConvoIndex == 5)
                    currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 1);
            }

            Instantiate (currentRELevel, currentRELevel.transform.position, Quaternion.identity);
        }
        if (SceneManager.GetActiveScene ().name == "Irritation") {
            GameObject instructions = Instantiate (ProtectCookie, new Vector3 (Camera.main.transform.position.x, Camera.main.transform.position.y, 1), Quaternion.identity) as GameObject;
            _currentInstructions = instructions.GetComponent<SpriteRenderer> ();
        }
        if (SceneManager.GetActiveScene ().name == "FindingFriends") {
            GameObject fFLevel = new GameObject ();
            if (CurrentCharacterType == CharacterType.Marlon) {
                if (CurrentConvoIndex == 3)
                    fFLevel = Resources.Load<GameObject> ("Prefabs/Minigames/FindingFriends/Level 1 Hard");
                if (CurrentConvoIndex == 4)
                    fFLevel = Resources.Load<GameObject> ("Prefabs/Minigames/FindingFriends/Level 1 Easy");
            } else if (CurrentCharacterType == CharacterType.Isaac) {
                if (CurrentConvoIndex == 2)
                    fFLevel = Resources.Load<GameObject> ("Prefabs/Minigames/FindingFriends/Level 1 Hard");
                if (CurrentConvoIndex == 3)
                    fFLevel = Resources.Load<GameObject> ("Prefabs/Minigames/FindingFriends/Level 1 Easy");
            }
            fFLevel = (GameObject)Instantiate (fFLevel, fFLevel.transform.position, Quaternion.identity);

            _fireflyLightRenderer = GameObject.Find ("Player").GetComponentInChildren<MeshRenderer> ();
            _playerLightController = _fireflyLightRenderer.gameObject.GetComponent<LightController> ();
            _fireflyLightRenderer.enabled = false;
            _playerLightController.enabled = false;
            GameObject instructions = Instantiate (FindFF, new Vector3 (Camera.main.transform.position.x, Camera.main.transform.position.y, 1), Quaternion.identity) as GameObject;
            _currentInstructions = instructions.GetComponent<SpriteRenderer> ();
        }
    }
    public static RadComboBoxItemData[] GetReplaceTypeComboData(int id, SelectedType type, int ticketTypeID)
    {
        //IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context;
        List <RadComboBoxItemData> list = new List <RadComboBoxItemData>();

        /*string[] s = context["FilterString"].ToString().Split(',');
         * SelectedType type = (SelectedType)int.Parse(s[0]);
         * int ticketTypeID = int.Parse(s[1]);
         * int id = int.Parse(s[2]);*/

        BaseCollection collection  = null;
        string         nameColName = "Name";
        string         idColName   = "ID";

        switch (type)
        {
        case SelectedType.ActionTypes:
            ActionTypes actionTypes = new ActionTypes(UserSession.LoginUser);
            actionTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = actionTypes;
            idColName  = "ActionTypeID";
            break;

        case SelectedType.PhoneTypes:
            PhoneTypes phoneTypes = new PhoneTypes(UserSession.LoginUser);
            phoneTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = phoneTypes;
            idColName  = "PhoneTypeID";
            break;

        case SelectedType.ProductVersionStatuses:
            ProductVersionStatuses productVersionStatuses = new ProductVersionStatuses(UserSession.LoginUser);
            productVersionStatuses.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = productVersionStatuses;
            idColName  = "ProductVersionStatusID";
            break;

        case SelectedType.TicketSeverities:
            TicketSeverities ticketSeverities = new TicketSeverities(UserSession.LoginUser);
            ticketSeverities.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = ticketSeverities;
            idColName  = "TicketSeverityID";
            break;

        case SelectedType.TicketStatuses:
            TicketStatuses ticketStatuses = new TicketStatuses(UserSession.LoginUser);
            TicketType     ticketType     = TicketTypes.GetTicketType(UserSession.LoginUser, ticketTypeID);
            if (ticketType.OrganizationID == UserSession.LoginUser.OrganizationID)
            {
                ticketStatuses.LoadAllPositions(ticketTypeID);
                collection = ticketStatuses;
                idColName  = "TicketStatusID";
            }
            break;

        case SelectedType.TicketTypes:
            TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);
            ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = ticketTypes;
            idColName  = "TicketTypeID";
            break;

        case SelectedType.ActivityTypes:
            ActivityTypes activityTypes = new ActivityTypes(UserSession.LoginUser);
            activityTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            //Load base items
            //Get default activity types
            foreach (ActivityTypeEnum activity in Enum.GetValues(typeof(ActivityTypeEnum)))
            {
                var value = Enum.Parse(typeof(ActivityTypeEnum), activity.ToString());
                //results.Add(new ActivityTypesDropDown() { Name = activity.ToString(), Value = (int)value });
                RadComboBoxItemData itemData = new RadComboBoxItemData();
                itemData.Text  = activity.ToString();
                itemData.Value = ((int)value).ToString();
                list.Add(itemData);
            }

            collection = activityTypes;
            idColName  = "ActivityTypeID";
            break;

        default:
            break;
        }

        foreach (DataRow row in collection.Table.Rows)
        {
            int i = (int)row[idColName];
            if (id != i)
            {
                RadComboBoxItemData itemData = new RadComboBoxItemData();
                itemData.Text  = row[nameColName].ToString();
                itemData.Value = i.ToString();
                list.Add(itemData);
            }
        }

        if (list.Count < 1)
        {
            RadComboBoxItemData noData = new RadComboBoxItemData();
            noData.Text  = "[No types to display.]";
            noData.Value = "-1";
            list.Add(noData);
        }

        return(list.ToArray());
    }
示例#19
0
 public virtual bool AddPhoneNumberFor(string personId, PhoneTypes phoneType, string phoneNumber)
 {
     throw new System.NotImplementedException();
 }
示例#20
0
 /// <summary>
 /// This is overridden to allow copying of the additional properties
 /// </summary>
 /// <param name="p">The PDI object from which the settings are to be copied</param>
 protected override void Clone(PDIObject p)
 {
     this.PhoneTypes = ((TelephoneProperty)p).PhoneTypes;
     base.Clone(p);
 }
    public static string GetTypesHtml(SelectedType type, string arg)
    {
        Organization organization = Organizations.GetOrganization(UserSession.LoginUser, UserSession.LoginUser.OrganizationID);
        DataTable    table        = new DataTable();

        table.Columns.Add("ID");
        table.Columns.Add("Name");
        table.Columns.Add("Description");
        string result = "";

        switch (type)
        {
        case SelectedType.ActionTypes:
            ActionTypes actionTypes = new ActionTypes(UserSession.LoginUser);
            actionTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            table.Columns.Add("Is Timed");
            foreach (ActionType actionType in actionTypes)
            {
                table.Rows.Add(new string[] { actionType.ActionTypeID.ToString(), actionType.Name, actionType.Description, actionType.IsTimed.ToString() });
            }
            break;

        case SelectedType.PhoneTypes:
            PhoneTypes phoneTypes = new PhoneTypes(UserSession.LoginUser);
            phoneTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            foreach (PhoneType phoneType in phoneTypes)
            {
                table.Rows.Add(new string[] { phoneType.PhoneTypeID.ToString(), phoneType.Name, phoneType.Description });
            }
            break;

        case SelectedType.ProductVersionStatuses:
            ProductVersionStatuses productVersionStatuses = new ProductVersionStatuses(UserSession.LoginUser);
            productVersionStatuses.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            table.Columns.Add("Is Shipping");
            table.Columns.Add("Is Discontinued");
            foreach (ProductVersionStatus productVersionStatus in productVersionStatuses)
            {
                table.Rows.Add(new string[] { productVersionStatus.ProductVersionStatusID.ToString(), productVersionStatus.Name, productVersionStatus.Description, productVersionStatus.IsShipping.ToString(), productVersionStatus.IsDiscontinued.ToString() });
            }
            break;

        case SelectedType.TicketSeverities:
            table.Columns.Add("Visible on Portal");
            TicketSeverities ticketSeverities = new TicketSeverities(UserSession.LoginUser);
            ticketSeverities.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            foreach (TicketSeverity ticketSeverity in ticketSeverities)
            {
                table.Rows.Add(new string[] { ticketSeverity.TicketSeverityID.ToString(), ticketSeverity.Name, ticketSeverity.Description, ticketSeverity.VisibleOnPortal.ToString() });
            }
            break;

        case SelectedType.TicketStatuses:
            TicketStatuses ticketStatuses = new TicketStatuses(UserSession.LoginUser);
            ticketStatuses.LoadAllPositions(int.Parse(arg));

            table.Columns.Add("Is Closed");
            table.Columns.Add("Closed Email");
            table.Columns.Add("Email Response");
            table.Columns.Add("Pause SLA");

            foreach (TicketStatus ticketStatus in ticketStatuses)
            {
                table.Rows.Add(new string[] { ticketStatus.TicketStatusID.ToString(), ticketStatus.Name, ticketStatus.Description, ticketStatus.IsClosed.ToString(), ticketStatus.IsClosedEmail.ToString(), ticketStatus.IsEmailResponse.ToString(), ticketStatus.PauseSLA.ToString() });
            }
            break;

        case SelectedType.TicketTypes:
            table.Columns.Add("Icon");
            table.Columns.Add("Visible on Portal");
            string icon = "<img src=\"../{0}\" />";
            if (organization.UseProductFamilies)
            {
                TicketTypesView ticketTypes = new TicketTypesView(UserSession.LoginUser);
                ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
                table.Columns.Add("Product Line");
                table.Columns.Add("Active");
                foreach (TicketTypesViewItem ticketType in ticketTypes)
                {
                    table.Rows.Add(new string[] { ticketType.TicketTypeID.ToString(), ticketType.Name, ticketType.Description, string.Format(icon, ticketType.IconUrl), ticketType.IsVisibleOnPortal.ToString(), ticketType.ProductFamilyName });
                }
            }
            else
            {
                TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);
                ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
                table.Columns.Add("Active");
                foreach (TicketType ticketType in ticketTypes)
                {
                    table.Rows.Add(new string[] { ticketType.TicketTypeID.ToString(), ticketType.Name, ticketType.Description, string.Format(icon, ticketType.IconUrl), ticketType.IsVisibleOnPortal.ToString() });
                }
            }
            break;

        case SelectedType.ActivityTypes:
            ActivityTypes activityTypes = new ActivityTypes(UserSession.LoginUser);
            activityTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            foreach (ActivityType activityType in activityTypes)
            {
                table.Rows.Add(new string[] { activityType.ActivityTypeID.ToString(), activityType.Name, activityType.Description });
            }
            break;

        default:
            break;
        }

        return(BuildTable(table));
    }
    public static string ReplaceType(SelectedType type, int oldID, int newID, string arg)
    {
        if (!UserSession.CurrentUser.IsSystemAdmin)
        {
            return("");
        }
        switch (type)
        {
        case SelectedType.ActionTypes:
            if (ActionTypes.GetActionType(UserSession.LoginUser, oldID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            if (ActionTypes.GetActionType(UserSession.LoginUser, newID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            (new Actions(UserSession.LoginUser)).ReplaceActionType(oldID, newID);
            ActionTypes actionTypes = new ActionTypes(UserSession.LoginUser);
            actionTypes.DeleteFromDB(oldID);
            actionTypes.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.PhoneTypes:
            if (PhoneTypes.GetPhoneType(UserSession.LoginUser, oldID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            if (PhoneTypes.GetPhoneType(UserSession.LoginUser, newID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            (new PhoneNumbers(UserSession.LoginUser)).ReplacePhoneType(oldID, newID);
            PhoneTypes phoneTypes = new PhoneTypes(UserSession.LoginUser);
            phoneTypes.DeleteFromDB(oldID);
            phoneTypes.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.ProductVersionStatuses:
            if (ProductVersionStatuses.GetProductVersionStatus(UserSession.LoginUser, oldID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            if (ProductVersionStatuses.GetProductVersionStatus(UserSession.LoginUser, newID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            (new ProductVersions(UserSession.LoginUser)).ReplaceProductVersionStatus(oldID, newID);
            ProductVersionStatuses productVersionStatuses = new ProductVersionStatuses(UserSession.LoginUser);
            productVersionStatuses.DeleteFromDB(oldID);
            productVersionStatuses.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.TicketSeverities:
            if (TicketSeverities.GetTicketSeverity(UserSession.LoginUser, oldID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            if (TicketSeverities.GetTicketSeverity(UserSession.LoginUser, newID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            (new Tickets(UserSession.LoginUser)).ReplaceTicketSeverity(oldID, newID);
            TicketSeverities ticketSeverities = new TicketSeverities(UserSession.LoginUser);
            ticketSeverities.DeleteFromDB(oldID);
            ticketSeverities.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.TicketStatuses:
            TicketStatus oldStatus = TicketStatuses.GetTicketStatus(UserSession.LoginUser, oldID);
            if (oldStatus.OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            if (TicketStatuses.GetTicketStatus(UserSession.LoginUser, newID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            (new Tickets(UserSession.LoginUser)).ReplaceTicketStatus(oldID, newID);
            TicketStatuses ticketStatuses = new TicketStatuses(UserSession.LoginUser);
            ticketStatuses.DeleteFromDB(oldID);
            ticketStatuses.ValidatePositions(oldStatus.TicketTypeID);
            break;

        case SelectedType.TicketTypes:
            if (TicketTypes.GetTicketType(UserSession.LoginUser, oldID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            if (TicketTypes.GetTicketType(UserSession.LoginUser, newID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            (new Tickets(UserSession.LoginUser)).ReplaceTicketType(oldID, newID);
            TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);

            CustomFields customFields = new CustomFields(UserSession.LoginUser);
            customFields.LoadByTicketTypeID(UserSession.LoginUser.OrganizationID, oldID);

            ticketTypes.DeleteFromDB(oldID);
            ticketTypes.ValidatePositions(UserSession.LoginUser.OrganizationID);

            int?crmLinkFieldId = null;

            foreach (CustomField customField in customFields)
            {
                try
                {
                    crmLinkFieldId = CRMLinkFields.FindIdByCustomFieldId(customField.CustomFieldID, UserSession.LoginUser);
                }
                catch (Exception ex)
                {
                    crmLinkFieldId = null;
                }

                if (crmLinkFieldId != null && crmLinkFieldId > 0)
                {
                    CRMLinkFields crmLinkFieldsDelete = new CRMLinkFields(UserSession.LoginUser);
                    crmLinkFieldsDelete.DeleteFromDB((int)crmLinkFieldId);
                }
            }

            break;

        case SelectedType.ActivityTypes:
            if (ActivityTypes.GetActivityType(UserSession.LoginUser, oldID).OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return("");
            }
            var types = Enum.GetValues(typeof(ActivityTypeEnum));
            if (newID > types.Length)
            {
                if (ActivityTypes.GetActivityType(UserSession.LoginUser, newID).OrganizationID != UserSession.LoginUser.OrganizationID)
                {
                    return("");
                }
            }
            (new Notes(UserSession.LoginUser)).ReplaceActivityType(oldID, newID);
            ActivityTypes activityTypes = new ActivityTypes(UserSession.LoginUser);
            activityTypes.DeleteFromDB(oldID);
            activityTypes.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        default:
            break;
        }
        return(GetTypesHtml(type, arg));
    }
示例#23
0
 /// <summary>
 /// This is overridden to allow copying of the additional properties
 /// </summary>
 /// <param name="p">The PDI object from which the settings are to be copied</param>
 protected override void Clone(PDIObject p)
 {
     phoneTypes = ((TelephoneProperty)p).PhoneTypes;
     base.Clone(p);
 }
示例#24
0
 internal void PopulatePhoneType(PhoneTypes types)
 {
     foreach(Telephone phone in currentContact.GetTelephoneNumbers())
        {
     if( types != PhoneTypes.preferred )
     {
      if( (phone.Types & PhoneTypes.preferred) ==
        PhoneTypes.preferred)
      {
       continue;
      }
     }
     if( (phone.Types & types) != types)
     {
      continue;
     }
     if(phoneOne == null)
     {
      phoneOne = phone;
      PhoneOneEntry.Text = phone.Number;
      SetPhoneOptionMenu(POneOptionMenu, phone.Types);
     }
     else if(phoneTwo == null)
     {
      phoneTwo = phone;
      PhoneTwoEntry.Text = phone.Number;
      SetPhoneOptionMenu(PTwoOptionMenu, phone.Types);
     }
     else if(phoneThree == null)
     {
      phoneThree = phone;
      PhoneThreeEntry.Text = phone.Number;
      SetPhoneOptionMenu(PThreeOptionMenu, phone.Types);
     }
     else if(phoneFour == null)
     {
      phoneFour = phone;
      PhoneFourEntry.Text = phone.Number;
      SetPhoneOptionMenu(PFourOptionMenu, phone.Types);
     }
        }
 }
示例#25
0
 /// <summary>
 ///     Creates a new <see cref="Phone" /> with the specified number and subtype.
 /// </summary>
 /// <param name="fullNumber">The phone number.</param>
 /// <param name="phoneType">The phone subtype.</param>
 public Phone(string fullNumber, PhoneTypes phoneType)
 {
     _fullNumber = fullNumber;
     _phoneType  = phoneType;
 }
    public static TypeObject GetTypeObject(SelectedType type, int id)
    {
        TypeObject result = new TypeObject();

        switch (type)
        {
        case SelectedType.ActionTypes:
            ActionType actionType = ActionTypes.GetActionType(UserSession.LoginUser, id);
            result.ID          = actionType.ActionTypeID;
            result.Name        = actionType.Name;
            result.Description = actionType.Description;
            result.IsTimed     = actionType.IsTimed;
            break;

        case SelectedType.PhoneTypes:
            PhoneType phoneType = PhoneTypes.GetPhoneType(UserSession.LoginUser, id);
            result.ID          = phoneType.PhoneTypeID;
            result.Name        = phoneType.Name;
            result.Description = phoneType.Description;
            break;

        case SelectedType.ProductVersionStatuses:
            ProductVersionStatus productVersionStatus = ProductVersionStatuses.GetProductVersionStatus(UserSession.LoginUser, id);
            result.ID             = productVersionStatus.ProductVersionStatusID;
            result.Name           = productVersionStatus.Name;
            result.Description    = productVersionStatus.Description;
            result.IsShipping     = productVersionStatus.IsShipping;
            result.IsDiscontinued = productVersionStatus.IsDiscontinued;
            break;

        case SelectedType.TicketSeverities:
            TicketSeverity ticketSeverity = TicketSeverities.GetTicketSeverity(UserSession.LoginUser, id);
            result.ID                = ticketSeverity.TicketSeverityID;
            result.Name              = ticketSeverity.Name;
            result.Description       = ticketSeverity.Description;
            result.IsVisibleOnPortal = ticketSeverity.VisibleOnPortal;
            break;

        case SelectedType.TicketStatuses:
            TicketStatus ticketStatus = TicketStatuses.GetTicketStatus(UserSession.LoginUser, id);
            result.ID              = ticketStatus.TicketStatusID;
            result.Name            = ticketStatus.Name;
            result.Description     = ticketStatus.Description;
            result.IsClosed        = ticketStatus.IsClosed;
            result.IsClosedEmail   = ticketStatus.IsClosedEmail;
            result.IsEmailResponse = ticketStatus.IsEmailResponse;
            result.PauseSla        = ticketStatus.PauseSLA;
            break;

        case SelectedType.TicketTypes:
            TicketType ticketType = TicketTypes.GetTicketType(UserSession.LoginUser, id);
            result.ID                = ticketType.TicketTypeID;
            result.Name              = ticketType.Name;
            result.Description       = ticketType.Description;
            result.IsVisibleOnPortal = ticketType.IsVisibleOnPortal;
            result.IconUrl           = ticketType.IconUrl;
            result.IsActive          = ticketType.IsActive;
            result.ExcludeFromCDI    = ticketType.ExcludeFromCDI;

            if (ticketType.ProductFamilyID == null)
            {
                result.ProductFamilyID = -1;
            }
            else
            {
                result.ProductFamilyID = (int)ticketType.ProductFamilyID;
            }

            break;

        case SelectedType.ActivityTypes:
            ActivityType activityType = ActivityTypes.GetActivityType(UserSession.LoginUser, id);
            result.ID          = activityType.ActivityTypeID;
            result.Name        = activityType.Name;
            result.Description = activityType.Description;
            break;

        default:
            break;
        }

        return(result);
    }
示例#27
0
        /// <summary>
        /// This is overridden to provide custom handling of the TYPE parameter
        /// </summary>
        /// <param name="parameters">The parameters for the property.</param>
        public override void DeserializeParameters(StringCollection parameters)
        {
            string[] types;
            int idx, subIdx;

            if(parameters == null || parameters.Count == 0)
                return;

            PhoneTypes pt = PhoneTypes.None;

            for(int paramIdx = 0; paramIdx < parameters.Count; paramIdx++)
            {
                for(idx = 0; idx < ntv.Length; idx++)
                    if(ntv[idx].IsMatch(parameters[paramIdx]))
                        break;

                if(idx == ntv.Length)
                {
                    // If it was a parameter name, skip the value too
                    if(parameters[paramIdx].EndsWith("=", StringComparison.Ordinal))
                        paramIdx++;

                    continue;   // Not a phone parameter
                }

                // Parameters may appear as a pair (name followed by value) or by value alone
                if(!ntv[idx].IsParameterValue && paramIdx < parameters.Count - 1)
                {
                    // Remove the TYPE parameter name so that the base class won't put it in the custom
                    // parameters.  We'll skip this one and decode the parameter value.
                    parameters.RemoveAt(paramIdx);

                    // If the values contain a comma, split it on the comma and parse the types (i.e. vCard 3.0
                    // spec).  If not, just continue and handle it as normal.
                    if(reSplit.IsMatch(parameters[paramIdx]))
                    {
                        types = reSplit.Split(parameters[paramIdx]);

                        foreach(string s in types)
                        {
                            for(subIdx = 1; subIdx < ntv.Length; subIdx++)
                                if(ntv[subIdx].IsMatch(s))
                                    break;

                            // Unrecognized ones are ignored
                            if(subIdx < ntv.Length)
                                pt |= ntv[subIdx].EnumValue;
                        }

                        parameters.RemoveAt(paramIdx);
                    }
                }
                else
                {
                    pt |= ntv[idx].EnumValue;

                    // As above, remove the value
                    parameters.RemoveAt(paramIdx);
                }

                paramIdx--;
            }

            if(pt != PhoneTypes.None)
                this.PhoneTypes = pt;

            // Let the base class handle all other parameters
            base.DeserializeParameters(parameters);
        }
示例#28
0
        //=====================================================================

        /// <summary>
        /// Default constructor.  Unless the version is changed, the object will conform to the vCard 3.0
        /// specification.
        /// </summary>
        public TelephoneProperty()
        {
            this.Version    = SpecificationVersions.vCard30;
            this.PhoneTypes = PhoneTypes.Voice;
        }
        private void PopulatePhoneTypes()
        {
            var phoneTypesData = HttpHelper.Get<PhoneTypesData>(serviceBaseUri+"/PhoneTypes");

            var phoneTypes = new PhoneTypes();
            mapper.MapList(phoneTypesData, phoneTypes, typeof (PhoneType));
            ViewData["phoneTypes"] = phoneTypes;
        }
示例#30
0
        /// <summary>
        /// This is overridden to provide custom handling of the TYPE parameter
        /// </summary>
        /// <param name="parameters">The parameters for the property.</param>
        public override void DeserializeParameters(StringCollection parameters)
        {
            string[] types;
            int      idx, subIdx;

            if (parameters == null || parameters.Count == 0)
            {
                return;
            }

            PhoneTypes pt = PhoneTypes.None;

            for (int paramIdx = 0; paramIdx < parameters.Count; paramIdx++)
            {
                for (idx = 0; idx < ntv.Length; idx++)
                {
                    if (ntv[idx].IsMatch(parameters[paramIdx]))
                    {
                        break;
                    }
                }

                if (idx == ntv.Length)
                {
                    // If it was a parameter name, skip the value too
                    if (parameters[paramIdx].EndsWith("=", StringComparison.Ordinal))
                    {
                        paramIdx++;
                    }

                    continue;   // Not a phone parameter
                }

                // Parameters may appear as a pair (name followed by value) or by value alone
                if (!ntv[idx].IsParameterValue && paramIdx < parameters.Count - 1)
                {
                    // Remove the TYPE parameter name so that the base class won't put it in the custom
                    // parameters.  We'll skip this one and decode the parameter value.
                    parameters.RemoveAt(paramIdx);

                    // If the values contain a comma, split it on the comma and parse the types (i.e. vCard 3.0
                    // spec).  If not, just continue and handle it as normal.
                    if (reSplit.IsMatch(parameters[paramIdx]))
                    {
                        types = reSplit.Split(parameters[paramIdx]);

                        foreach (string s in types)
                        {
                            for (subIdx = 1; subIdx < ntv.Length; subIdx++)
                            {
                                if (ntv[subIdx].IsMatch(s))
                                {
                                    break;
                                }
                            }

                            // Unrecognized ones are ignored
                            if (subIdx < ntv.Length)
                            {
                                pt |= ntv[subIdx].EnumValue;
                            }
                        }

                        parameters.RemoveAt(paramIdx);
                    }
                }
                else
                {
                    pt |= ntv[idx].EnumValue;

                    // As above, remove the value
                    parameters.RemoveAt(paramIdx);
                }

                paramIdx--;
            }

            if (pt != PhoneTypes.None)
            {
                this.PhoneTypes = pt;
            }

            // Let the base class handle all other parameters
            base.DeserializeParameters(parameters);
        }
    public static string UpdateType(SelectedType type,
                                    string arg,
                                    int?id,
                                    string name,
                                    string description,
                                    bool isTimed,
                                    bool isClosed,
                                    bool isClosedEmail,
                                    bool isEmailResponse,
                                    bool pauseSla,
                                    bool isShipping,
                                    bool isDiscontinued,
                                    string productFamilyID,
                                    string iconUrl,
                                    bool isVisibleOnPortal,
                                    bool isActive,
                                    bool ExcludeFromCDI)
    {
        if (!UserSession.CurrentUser.IsSystemAdmin)
        {
            return("");
        }
        switch (type)
        {
        case SelectedType.ActionTypes:
            ActionType actionType = id == null ? (new ActionTypes(UserSession.LoginUser)).AddNewActionType() : ActionTypes.GetActionType(UserSession.LoginUser, (int)id);
            actionType.IsTimed     = isTimed;
            actionType.Name        = name;
            actionType.Description = description;
            if (id == null)
            {
                actionType.Position = actionType.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                actionType.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            actionType.Collection.Save();
            actionType.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.PhoneTypes:
            PhoneType phoneType = id == null ? (new PhoneTypes(UserSession.LoginUser)).AddNewPhoneType() : PhoneTypes.GetPhoneType(UserSession.LoginUser, (int)id);
            phoneType.Name        = name;
            phoneType.Description = description;
            if (id == null)
            {
                phoneType.Position = phoneType.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                phoneType.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            phoneType.Collection.Save();
            phoneType.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.ProductVersionStatuses:
            ProductVersionStatus productVersionStatus = id == null ? (new ProductVersionStatuses(UserSession.LoginUser)).AddNewProductVersionStatus() : ProductVersionStatuses.GetProductVersionStatus(UserSession.LoginUser, (int)id);
            productVersionStatus.IsDiscontinued = isDiscontinued;
            productVersionStatus.IsShipping     = isShipping;
            productVersionStatus.Name           = name;
            productVersionStatus.Description    = description;
            if (id == null)
            {
                productVersionStatus.Position = productVersionStatus.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                productVersionStatus.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            productVersionStatus.Collection.Save();
            productVersionStatus.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.TicketSeverities:
            TicketSeverity ticketSeverity = id == null ? (new TicketSeverities(UserSession.LoginUser)).AddNewTicketSeverity() : TicketSeverities.GetTicketSeverity(UserSession.LoginUser, (int)id);
            ticketSeverity.Name        = name;
            ticketSeverity.Description = description;
            if (id == null)
            {
                ticketSeverity.Position = ticketSeverity.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                ticketSeverity.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            ticketSeverity.VisibleOnPortal = isVisibleOnPortal;
            ticketSeverity.Collection.Save();
            ticketSeverity.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.TicketStatuses:
            if (isEmailResponse == true)
            {
                TicketStatuses statuses = new TicketStatuses(UserSession.LoginUser);
                statuses.LoadByTicketTypeID(int.Parse(arg));
                foreach (TicketStatus status in statuses)
                {
                    status.IsEmailResponse = false;
                }
                statuses.Save();
            }

            TicketStatus ticketStatus = id == null ? (new TicketStatuses(UserSession.LoginUser)).AddNewTicketStatus() : TicketStatuses.GetTicketStatus(UserSession.LoginUser, (int)id);
            ticketStatus.TicketTypeID    = int.Parse(arg);
            ticketStatus.IsClosed        = isClosed;
            ticketStatus.IsClosedEmail   = isClosedEmail;
            ticketStatus.IsEmailResponse = isEmailResponse;
            ticketStatus.PauseSLA        = pauseSla;
            ticketStatus.Name            = name;
            ticketStatus.Description     = description;
            if (id == null)
            {
                ticketStatus.Position = ticketStatus.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                ticketStatus.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            ticketStatus.Collection.Save();
            ticketStatus.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.TicketTypes:
            TicketType ticketType = id == null ? (new TicketTypes(UserSession.LoginUser)).AddNewTicketType() : TicketTypes.GetTicketType(UserSession.LoginUser, (int)id);
            ticketType.Name              = name;
            ticketType.Description       = description;
            ticketType.IconUrl           = iconUrl;
            ticketType.IsVisibleOnPortal = isVisibleOnPortal;
            ticketType.IsActive          = isActive;
            ticketType.ExcludeFromCDI    = ExcludeFromCDI;
            if (id == null)
            {
                ticketType.Position = ticketType.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                ticketType.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            if (productFamilyID == "-1")
            {
                ticketType.ProductFamilyID = null;
            }
            else
            {
                ticketType.ProductFamilyID = Convert.ToInt32(productFamilyID);
            }

            ticketType.Collection.Save();
            ticketType.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            if (id == null)
            {
                try
                {
                    System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand();
                    command.CommandText = "UPDATE Users SET MenuItems = MenuItems + ',mniTicketType_" + ticketType.TicketTypeID.ToString() + "' WHERE UserID IN (SELECT UserID WHERE OrganizationID = @OrganizationID)";
                    command.Parameters.AddWithValue("OrganizationID", UserSession.LoginUser.OrganizationID);
                    SqlExecutor.ExecuteNonQuery(UserSession.LoginUser, command);
                }
                catch (Exception ex)
                {
                    ExceptionLogs.LogException(UserSession.LoginUser, ex, "Ticket Type Creation - menu item");
                }

                TicketStatuses ticketStatuses = new TicketStatuses(UserSession.LoginUser);
                ticketStatus                = ticketStatuses.AddNewTicketStatus();
                ticketStatus.Name           = "New";
                ticketStatus.Description    = "New";
                ticketStatus.Position       = 0;
                ticketStatus.OrganizationID = UserSession.LoginUser.OrganizationID;
                ticketStatus.TicketTypeID   = ticketType.TicketTypeID;
                ticketStatus.IsClosed       = false;
                ticketStatus.IsClosedEmail  = false;

                ticketStatus                = ticketStatuses.AddNewTicketStatus();
                ticketStatus.Name           = "Closed";
                ticketStatus.Description    = "Closed";
                ticketStatus.Position       = 30;
                ticketStatus.OrganizationID = UserSession.LoginUser.OrganizationID;
                ticketStatus.TicketTypeID   = ticketType.TicketTypeID;
                ticketStatus.IsClosed       = true;
                ticketStatus.IsClosedEmail  = false;
                ticketStatus.Collection.Save();
                ticketStatus.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);


/*          TicketNextStatuses ticketNextStatuses = new TicketNextStatuses(UserSession.LoginUser);
 *        ticketNextStatuses.AddNextStatus(ticketStatuses[0], ticketStatuses[1], 0);
 *        ticketNextStatuses.AddNextStatus(ticketStatuses[1], ticketStatuses[0], 1);
 *        ticketNextStatuses.Save();*/
            }

            break;

        case SelectedType.ActivityTypes:
            ActivityType activityType = id == null ? (new ActivityTypes(UserSession.LoginUser)).AddNewActivityType() : ActivityTypes.GetActivityType(UserSession.LoginUser, (int)id);
            activityType.Name        = name;
            activityType.Description = description;
            if (id == null)
            {
                activityType.Position = activityType.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                activityType.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            activityType.Collection.Save();
            activityType.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        default:
            break;
        }


        return(GetTypesHtml(type, arg));
    }
示例#32
0
        private void SaveCustomProperty()
        {
            switch (_refType)
            {
            case ReferenceType.ActionTypes:
                ActionType  actionType;
                ActionTypes actionTypes = new ActionTypes(LoginSession.LoginUser);

                if (_id < 0)
                {
                    actionType = actionTypes.AddNewActionType();
                    actionType.OrganizationID = _organizationID;
                    actionType.Position       = actionTypes.GetMaxPosition(_organizationID) + 1;
                }
                else
                {
                    actionTypes.LoadByActionTypeID(_id);
                    actionType = actionTypes[0];
                }
                actionType.Description = textDescription.Text;
                actionType.Name        = textName.Text;
                actionTypes.Save();
                break;

            case ReferenceType.PhoneTypes:
                PhoneType  phoneType;
                PhoneTypes phoneTypes = new PhoneTypes(LoginSession.LoginUser);

                if (_id < 0)
                {
                    phoneType = phoneTypes.AddNewPhoneType();
                    phoneType.OrganizationID = _organizationID;
                    phoneType.Position       = phoneTypes.GetMaxPosition(_organizationID) + 1;
                }
                else
                {
                    phoneTypes.LoadByPhoneTypeID(_id);
                    phoneType = phoneTypes[0];
                }
                phoneType.Description = textDescription.Text;
                phoneType.Name        = textName.Text;
                phoneTypes.Save();
                break;

            case ReferenceType.ProductVersionStatuses:
                ProductVersionStatus   productVersionStatus;
                ProductVersionStatuses productVersionStatuses = new ProductVersionStatuses(LoginSession.LoginUser);

                if (_id < 0)
                {
                    productVersionStatus = productVersionStatuses.AddNewProductVersionStatus();
                    productVersionStatus.OrganizationID = _organizationID;
                    productVersionStatus.Position       = productVersionStatuses.GetMaxPosition(_organizationID) + 1;
                }
                else
                {
                    productVersionStatuses.LoadByProductVersionStatusID(_id);
                    productVersionStatus = productVersionStatuses[0];
                }
                productVersionStatus.Description    = textDescription.Text;
                productVersionStatus.Name           = textName.Text;
                productVersionStatus.IsDiscontinued = cbDiscontinued.Checked;
                productVersionStatus.IsShipping     = cbShipping.Checked;
                productVersionStatuses.Save();
                break;

            case ReferenceType.TicketSeverities:
                TicketSeverity   ticketSeverity;
                TicketSeverities ticketSeverities = new TicketSeverities(LoginSession.LoginUser);

                if (_id < 0)
                {
                    ticketSeverity = ticketSeverities.AddNewTicketSeverity();
                    ticketSeverity.OrganizationID = _organizationID;
                    ticketSeverity.Position       = ticketSeverities.GetMaxPosition(_organizationID) + 1;
                }
                else
                {
                    ticketSeverities.LoadByTicketSeverityID(_id);
                    ticketSeverity = ticketSeverities[0];
                }
                ticketSeverity.Description = textDescription.Text;
                ticketSeverity.Name        = textName.Text;
                ticketSeverities.Save();

                break;

            case ReferenceType.TicketStatuses:
                TicketStatus   ticketStatus;
                TicketStatuses ticketStatuses = new TicketStatuses(LoginSession.LoginUser);

                if (_id < 0)
                {
                    ticketStatus = ticketStatuses.AddNewTicketStatus();
                    ticketStatus.OrganizationID = _organizationID;
                    ticketStatus.TicketTypeID   = _ticketTypeID;
                    ticketStatus.Position       = ticketStatuses.GetMaxPosition(_ticketTypeID) + 1;
                }
                else
                {
                    ticketStatuses.LoadByTicketStatusID(_id);
                    ticketStatus = ticketStatuses[0];
                }
                ticketStatus.Description = textDescription.Text;
                ticketStatus.Name        = textName.Text;
                ticketStatus.IsClosed    = cbClosed.Checked;
                ticketStatuses.Save();
                break;

            default:
                break;
            }
        }
        private void LoadCustomProperties()
        {
            int oldID = GetSelectedPropertyID();

            ReferenceType refType = GetSelectedPropertyType();

            DataTable table = new DataTable();

            table.Columns.Add("ID", System.Type.GetType("System.Int32"));
            table.Columns.Add("Name");
            table.Columns.Add("Description");
            table.Columns.Add("IsClosed", System.Type.GetType("System.Boolean"));
            table.Columns.Add("IsShipping", System.Type.GetType("System.Boolean"));
            table.Columns.Add("IsDiscontinued", System.Type.GetType("System.Boolean"));

            gridProperties.Columns["IsShipping"].IsVisible     = false;
            gridProperties.Columns["IsDiscontinued"].IsVisible = false;
            gridProperties.Columns["IsClosed"].IsVisible       = false;

            switch (refType)
            {
            case ReferenceType.ActionTypes:
                ActionTypes actionTypes = new ActionTypes(LoginSession.LoginUser);
                actionTypes.LoadAllPositions(OrganizationID);
                foreach (ActionType actionType in actionTypes)
                {
                    DataRow row = table.NewRow();
                    row[0] = actionType.ActionTypeID;
                    row[1] = actionType.Name;
                    row[2] = actionType.Description;
                    row[3] = false;
                    row[4] = false;
                    row[5] = false;
                    table.Rows.Add(row);
                }

                break;

            case ReferenceType.PhoneTypes:
                PhoneTypes phoneTypes = new PhoneTypes(LoginSession.LoginUser);
                phoneTypes.LoadAllPositions(OrganizationID);
                foreach (PhoneType phoneType in phoneTypes)
                {
                    DataRow row = table.NewRow();
                    row[0] = phoneType.PhoneTypeID;
                    row[1] = phoneType.Name;
                    row[2] = phoneType.Description;
                    row[3] = false;
                    row[4] = false;
                    row[5] = false;
                    table.Rows.Add(row);
                }
                break;

            case ReferenceType.ProductVersionStatuses:
                ProductVersionStatuses productVersionStatuses = new ProductVersionStatuses(LoginSession.LoginUser);
                productVersionStatuses.LoadAllPositions(OrganizationID);
                foreach (ProductVersionStatus productVersionStatus in productVersionStatuses)
                {
                    DataRow row = table.NewRow();
                    row[0] = productVersionStatus.ProductVersionStatusID;
                    row[1] = productVersionStatus.Name;
                    row[2] = productVersionStatus.Description;
                    row[3] = false;
                    row[4] = productVersionStatus.IsShipping;
                    row[5] = productVersionStatus.IsDiscontinued;
                    table.Rows.Add(row);
                }
                gridProperties.Columns["IsShipping"].IsVisible     = true;
                gridProperties.Columns["IsDiscontinued"].IsVisible = true;
                break;

            case ReferenceType.TicketSeverities:
                TicketSeverities ticketSeverities = new TicketSeverities(LoginSession.LoginUser);
                ticketSeverities.LoadAllPositions(OrganizationID);
                foreach (TicketSeverity ticketSeverity in ticketSeverities)
                {
                    DataRow row = table.NewRow();
                    row[0] = ticketSeverity.TicketSeverityID;
                    row[1] = ticketSeverity.Name;
                    row[2] = ticketSeverity.Description;
                    row[3] = false;
                    row[4] = false;
                    row[5] = false;
                    table.Rows.Add(row);
                }
                break;

            case ReferenceType.TicketStatuses:
                TicketStatuses ticketStatuses = new TicketStatuses(LoginSession.LoginUser);
                ticketStatuses.LoadAllPositions(GetSelectedTicketType());
                foreach (TicketStatus ticketStatus in ticketStatuses)
                {
                    DataRow row = table.NewRow();
                    row[0] = ticketStatus.TicketStatusID;
                    row[1] = ticketStatus.Name;
                    row[2] = ticketStatus.Description;
                    row[3] = ticketStatus.IsClosed;
                    row[4] = false;
                    row[5] = false;
                    table.Rows.Add(row);
                }
                gridProperties.Columns["IsClosed"].IsVisible = true;
                break;

            default:
                break;
            }



            gridProperties.DataSource = table;
            if (gridProperties.Rows.Count > 0)
            {
                gridProperties.Rows[0].IsCurrent = true;
            }
            SetSelectedPropertyID(oldID);
        }
示例#34
0
     internal void SetPhoneOptionMenu(Gtk.OptionMenu optMenu,
 PhoneTypes type)
     {
         if( (type & PhoneTypes.work) == PhoneTypes.work)
            {
         optMenu.SetHistory(0);
         return;
            }
            if( (type & PhoneTypes.home) == PhoneTypes.home)
            {
         optMenu.SetHistory(1);
         return;
            }
            optMenu.SetHistory(2);
     }
示例#35
0
        //=====================================================================

        /// <summary>
        /// Default constructor.  Unless the version is changed, the object will conform to the vCard 3.0
        /// specification.
        /// </summary>
        public TelephoneProperty()
        {
            this.Version = SpecificationVersions.vCard30;
            phoneTypes = PhoneTypes.Voice;
        }