Exemple #1
0
 public void Add(Phones entity)
 {
     _phonesDal.Add(entity);
 }
Exemple #2
0
 public void Update(Phones entity)
 {
     _phonesDal.Update(entity);
 }
Exemple #3
0
 private void tabMain_SelectedIndexChanged(object sender, EventArgs e)
 {
     refreshCurrentTabHelper(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList(), PhoneEmpSubGroups.GetAll());
 }
    protected void lnkbtnUpdate_Click(object sender, EventArgs e)
    {


        OrganizationInfo objOrg = new OrganizationInfo();

        objOrg.OrganizationId = OrganizationID;

        objOrg.LegalName = txtBusinessName.Text.Trim();
        objOrg.DBAName = txtDBAName.Text.Trim();
        objOrg.Website = txtWebsite.Text.Trim();
        objOrg.IsActive = true;
        objOrg.IsOrganization = true;
        objOrg.LanguageId = LanguageId;

        objOrg.RoleId = Conversion.ParseInt(UserInfo.UserRole.Stewardship);

        ContactInfo objPrimaryContact = new ContactInfo();

        objPrimaryContact.FirstName = txtFirstName.Text.Trim();
        objPrimaryContact.LastName = txtLastName.Text.Trim();
        objPrimaryContact.Email = txtPrimaryEmail.Text.Trim();

        objPrimaryContact.IsActive = true;
        objPrimaryContact.IsPrimary = true;
        objPrimaryContact.LanguageId = LanguageId;
        objPrimaryContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Business);

        Phones objPrimaryContactBusinessPhone = new Phones();

        objPrimaryContactBusinessPhone.Number = txtPhoneNumber.Text.Trim().ToString();
        objPrimaryContactBusinessPhone.Extension = txtPhoneExtension.Text.Trim().ToString();
        objPrimaryContactBusinessPhone.IsActive = true;
        objPrimaryContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

        Phones objPrimaryContactCellPhone = new Phones();

        objPrimaryContactCellPhone.Number = txtCellPhoneNumber.Text.Trim();
        objPrimaryContactCellPhone.IsActive = true;
        objPrimaryContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

        ContactInfo objBillingContact = new ContactInfo();
        objBillingContact.Email = txtBillingMailAddress.Text.Trim();
        objBillingContact.IsActive = true;
        objBillingContact.IsPrimary = false;
        objBillingContact.LanguageId = LanguageId;
        objBillingContact.ContactTypeId = Convert.ToInt32(ContactInfo.ContactTypes.Billing);
        objBillingContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Billing);

        Phones objBillingContactBusinessPhone = new Phones();
        objBillingContactBusinessPhone.IsActive = true;
        objBillingContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

        Phones objBillingContactCellPhone = new Phones();

        objBillingContactCellPhone.IsActive = true;
        objBillingContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

        OrganizationInfo.Organization_Address objBusinessOrganization_Address = new OrganizationInfo.Organization_Address();

        objBusinessOrganization_Address.ZipCodeID = Convert.ToInt32(hdnBusinessZipCodeId.Value);
        objBusinessOrganization_Address.ZipPostalCode = txtZipCode.Text.Trim().ToString();
        objBusinessOrganization_Address.Address1 = txtBusinessAddress1.Text.Trim();
        objBusinessOrganization_Address.Address2 = txtBusinessAddress2.Text.Trim();
        objBusinessOrganization_Address.City = txtCity.Text.Trim().ToString();
        objBusinessOrganization_Address.StateID = Convert.ToInt32(ddlState.SelectedValue);
        objBusinessOrganization_Address.CountryID = Convert.ToInt32(ddlCountry.SelectedValue);
        objBusinessOrganization_Address.DateCreated = DateTime.Now;
        objBusinessOrganization_Address.IsActive = true;
        objBusinessOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Business);

        OrganizationInfo.Organization_Address objMailingOrganization_Address = new OrganizationInfo.Organization_Address();
        objMailingOrganization_Address.DateCreated = DateTime.Now;
        objMailingOrganization_Address.IsActive = true;
        objMailingOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Mailing);

        OrganizationInfo.UpdateStewardshipInfo(objOrg, objPrimaryContact, objPrimaryContactBusinessPhone, objPrimaryContactCellPhone, objBillingContact, objBillingContactBusinessPhone, objBillingContactCellPhone, objBusinessOrganization_Address, objMailingOrganization_Address);
        lblinfo.Visible = true;
        lblinfo.Text = "Successfully updated";
        lblinfo.Style.Add("color", "green");
        viewStakeholdersForApproval();
        pnlDisplay.Visible = true;
        pnlEdit.Visible = false;

    }
        private void FillEmps()
        {
            gridEmp.BeginUpdate();
            gridEmp.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g("TableEmpClock", "Ext"), 25);
            gridEmp.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEmpClock", "Employee"), 60);
            gridEmp.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEmpClock", "Status"), 80);
            gridEmp.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEmpClock", "Phone"), 50);
            gridEmp.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEmpClock", "InOut"), 35);
            gridEmp.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEmpClock", "Customer"), 90);
            gridEmp.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEmpClock", "Time"), 70);
            gridEmp.Columns.Add(col);
            gridEmp.Rows.Clear();
            UI.ODGridRow row;
            PhoneList = Phones.GetPhoneList();
            DateTime dateTimeStart;
            TimeSpan span;
            DateTime timeOfDay;            //because TimeSpan does not have good formatting.

            for (int i = 0; i < PhoneList.Count; i++)
            {
                row = new OpenDental.UI.ODGridRow();
                row.Cells.Add(PhoneList[i].Extension.ToString());
                row.Cells.Add(PhoneList[i].EmployeeName);
                if (PhoneList[i].ClockStatus == ClockStatusEnum.None)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(PhoneList[i].ClockStatus.ToString());
                }
                row.Cells.Add(PhoneList[i].Description);
                row.Cells.Add(PhoneList[i].InOrOut);
                row.Cells.Add(PhoneList[i].CustomerNumber);
                dateTimeStart = PhoneList[i].DateTimeStart;
                if (dateTimeStart.Date == DateTime.Today)
                {
                    span      = DateTime.Now - dateTimeStart + timeDelta;
                    timeOfDay = DateTime.Today + span;
                    row.Cells.Add(timeOfDay.ToString("H:mm:ss"));
                }
                else
                {
                    row.Cells.Add("");
                }
                row.ColorBackG = PhoneList[i].ColorBar;
                row.ColorText  = PhoneList[i].ColorText;
                gridEmp.Rows.Add(row);
            }
            gridEmp.EndUpdate();
            gridEmp.SetSelected(false);
        }
Exemple #6
0
        public void IsValid()
        {
            if (Purpose == AddressPurposeType.Shipping)
            {
                if (Name.IsNullorEmpty())
                {
                    throw new ArgumentException("Nome inválido");
                }

                if (ContactName.IsNullorEmpty())
                {
                    throw new ArgumentException("Nome do destinatário inválido");
                }
            }

            if (Type == AddressType.None)
            {
                Type = AddressType.HomeAddress;
            }

            if (ZipCode.IsNullorEmpty() || ZipCode.ClearStrings().Length != 8)
            {
                throw new ArgumentException("CEP inválido");
            }

            if (Street.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Logradouro inválido");
            }

            if (Number.IsNullorEmpty())
            {
                throw new ArgumentException("Número inválido");
            }

            if (District.IsNullorEmpty())
            {
                throw new ArgumentException("Bairro inválido");
            }

            if (City.IsNullorEmpty())
            {
                throw new ArgumentException("Cidade inválida");
            }

            List <string> states = new List <string>()
            {
                "AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO"
            };

            if (!states.Contains(State))
            {
                throw new ArgumentException("Estado inválido");
            }

            if (Phones.Count == 0)
            {
                throw new ArgumentException("Telefone inválido. Informe ao menos 1");
            }

            var _phone = "";

            Phones.ForEach(phone =>
            {
                phone.DDD.Replace("\0", "").Replace("&#x0", "").Replace("\\0", "").Trim();

                if (!phone.DDD.IsNullorEmpty() && phone.DDD.TakeSpecialCharactersOff().Length != 2)
                {
                    if (phone.DDD.TakeSpecialCharactersOff().Length == 3)
                    {
                        phone.DDD = phone.DDD.Substring(1);
                    }
                    else if (phone.DDD.TakeSpecialCharactersOff().Length == 4)
                    {
                        phone.DDD = phone.DDD.Substring(2);
                    }
                    else
                    {
                        throw new ArgumentException("DDD inválido");
                    }
                }

                _phone = phone.Number.Replace("\0", "").Replace("&#x0", "").Replace("\\0", "").Trim();

                if (phone.PhoneType != PhoneType.Celular)
                {
                    if (!_phone.IsNullorEmpty() && _phone.ClearStrings().Length != 8 && _phone.ClearStrings().Length != 9)
                    {
                        throw new ArgumentException("Número de telefone inválido");
                    }
                }
                else
                {
                    if (!_phone.IsNullorEmpty() && _phone.ClearStrings().Length != 8 && _phone.ClearStrings().Length != 9)
                    {
                        throw new ArgumentException("Número de celular inválido");
                    }
                }
            });
        }
Exemple #7
0
 private void timerPhoneWebCam_Tick(object sender, EventArgs e)
 {
     if (vidCapt == null)
     {
         if (intPtrVideo != IntPtr.Zero)                 // Release any previous buffer
         {
             Marshal.FreeCoTaskMem(intPtrVideo);
             intPtrVideo = IntPtr.Zero;
         }
         int deviceCount = VideoCapture.GetDeviceCount();
         if (deviceCount > 0)
         {
             try {
                 vidCapt = new VideoCapture(0, 640, 480, 24, pictBoxVideo);
                 //image capture will now continue below if successful
             }
             catch {
                 Phones.SetWebCamImage(IpAddress192, null, Environment.MachineName);
                 return;                        //haven't actually seen this happen since we started properly disposing of vidCapt
             }
         }
         Phones.SetWebCamImage(IpAddress192, null, Environment.MachineName);
     }
     if (vidCapt != null)
     {
         if (intPtrVideo != IntPtr.Zero)                 // Release any previous buffer
         {
             Marshal.FreeCoTaskMem(intPtrVideo);
             intPtrVideo = IntPtr.Zero;
         }
         Bitmap bitmapSmall = null;
         try {
             intPtrVideo = vidCapt.Click();                     //will fail if camera unplugged
             Bitmap bitmap = new Bitmap(vidCapt.Width, vidCapt.Height, vidCapt.Stride, PixelFormat.Format24bppRgb, intPtrVideo);
             bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY); // If the image is upsidedown
             int w = 50;
             int h = (int)(((float)w) / 640f * 480f);
             bitmapSmall = new Bitmap(w, h);
             using (Graphics g = Graphics.FromImage(bitmapSmall)) {
                 g.DrawImage(bitmap, new Rectangle(0, 0, bitmapSmall.Width, bitmapSmall.Height));
             }
             bitmap.Dispose();
             bitmap = null;
         }
         catch {
             //bitmapSmall will remain null
             vidCapt.Dispose();
             vidCapt = null;                  //To prevent the above slow try/catch from happening again and again.
         }
         finally {
             //Marshal.FreeCoTaskMem(intPtrVideo);
         }
         if (IpAddress192 != "")               //found entry in phone table matching this machine ip.
         {
             Phones.SetWebCamImage(IpAddress192, bitmapSmall, Environment.MachineName);
         }
         if (bitmapSmall != null)
         {
             bitmapSmall.Dispose();
             bitmapSmall = null;
         }
     }
 }
    protected void lnkBtnLocationAdd_Click(object sender, EventArgs e)
    {
        try
        {
            //ddlRoleList.Items.Clear();
            //Utils.GetLookUpData<DropDownList>(ref ddlRoleList, LookUps.RoleName, Conversion.ParseInt(ddlOrganizationType.SelectedValue));

            OrganizationInfo objOrg = new OrganizationInfo();

            objOrg.LegalName = txtLocationBusinessName.Text.Trim();
            objOrg.DBAName = txtLocationDBAName.Text.Trim();
            objOrg.IsLocationEventPermanent = chkLocationPermanent.Checked;

            if (objOrg.IsLocationEventPermanent == false)
            {
                try
                {
                    objOrg.LocationEventTypeId = Convert.ToInt32(ddlLocationEventType.SelectedValue);
                    objOrg.LocationEventStartDate = Convert.ToDateTime(txtLocationFromDate.Text, System.Globalization.CultureInfo.InvariantCulture);
                    objOrg.LocationEventEndDate = Convert.ToDateTime(txtLocationToDate.Text, System.Globalization.CultureInfo.InvariantCulture);
                }
                catch (Exception ex)
                {
                    objOrg.IsLocationEventPermanent = true;
                }
            }

            objOrg.LocationPermitNumber = txtLocationPermitNumber.Text.Trim();
            objOrg.IsActive = true;
            objOrg.IsOrganization = false;
            objOrg.LanguageId = LanguageId;
            objOrg.ParentId = Convert.ToInt32(hdnOrganizationID.Value);

            ContactInfo objContact = new ContactInfo();

            objContact.FirstName = txtLocationContactFirstName.Text.Trim();
            objContact.LastName = txtLocationContactLastName.Text.Trim();
            objContact.ContactTitleId = Convert.ToInt32(ddlLocationContactTitle.SelectedValue);
            objContact.Email = txtLocationContactEmail.Text.Trim();
            objContact.IsActive = true;
            objContact.IsPrimary = true;
            objContact.LanguageId = LanguageId;
            //objContact.ContactTypeId = Convert.ToInt32(ContactInfo.ContactTypes.Business);
            objContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Business);

            Phones objBusinessPhone = new Phones();

            objBusinessPhone.Number = txtLocationBusinessPhone1.Text.Trim() + "-" + txtLocationBusinessPhone2.Text.Trim() + "-" + txtLocationBusinessPhone3.Text.Trim();
            objBusinessPhone.Extension = txtLocationBusinessPhoneExtension.Text.Trim();
            objBusinessPhone.IsActive = true;
            //objBusinessPhone.PhoneTypeId = Convert.ToInt32(Phones.PhoneType.Business);
            objBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

            Phones objCellPhone = new Phones();

            objCellPhone.Number = txtLocationCellPhone1.Text.Trim() + "-" + txtLocationCellPhone2.Text.Trim() + "-" + txtLocationCellPhone3.Text.Trim();
            objCellPhone.IsAcceptTextMessages = chkLocationContactAcceptTextMessages.Checked;
            objCellPhone.IsActive = true;
            //objCellPhone.PhoneTypeId = Convert.ToInt32(Phones.PhoneType.Cell);
            objCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

            OrganizationInfo.Organization_Address objOrganization_Address = new OrganizationInfo.Organization_Address();

            objOrganization_Address.ZipCodeID = Convert.ToInt32(hdnLocationZipCodeID.Value);
            objOrganization_Address.ZipPostalCode = txtLocationZipCode.Text.Trim();
            objOrganization_Address.Address1 = txtLocationAddress1.Text.Trim();
            objOrganization_Address.Address2 = txtLocationAddress2.Text.Trim();
            objOrganization_Address.City = txtLocationCity.Text;
            objOrganization_Address.StateID = Convert.ToInt32(ddlLocationState.SelectedValue);
            objOrganization_Address.CountryID = Convert.ToInt32(ddlLocationCountry.SelectedValue);
            objOrganization_Address.DateCreated = DateTime.Now;
            objOrganization_Address.IsActive = true;
            //objOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(OrganizationInfo.Organization_Address.Organization_AddressType.Business);
            objOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Business);

            OrganizationInfo.SaveAdditionalLocationInfo(objOrg, objContact, objBusinessPhone, objCellPhone, objOrganization_Address);

            gvAdditionLocations.DataSource = OrganizationInfo.GetAdditionalLocationsByOrganizationId(Convert.ToInt32(hdnOrganizationID.Value));
            gvAdditionLocations.DataBind();
            LoadHeaderTextForAddLocations();

            ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "ClearAdditionalLocationFields", "ClearAdditionalLocationFields();", true);

            txtLocationZipCode.Text = "";
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "RegistrationForm.lnkBtnAdditionalLocationAdd_Click", ex);
        }
    }
 public ChargeAdapterForAndroid(Phones.Android phone)
 {
     this.phone = phone;
 }
Exemple #10
0
        private void timerScreenShots_Tick(object sender, EventArgs e)
        {
            //ticks every 5 minutes
            int extension = Phones.IsOnClock(IpAddress192, Environment.MachineName);

            if (extension == 0)        //if this person is on break
            {
                return;                //don't save a screenshot
            }
            string folder = @"\\192.168.0.189\storage\My\Jordan\ScreenshotsByWorkstation\" + Environment.MachineName;

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            if (datePurged.Date != DateTime.Today)
            {
                string[] files = Directory.GetFiles(folder);
                for (int f = 0; f < files.Length; f++)
                {
                    if (files[f].EndsWith("db"))
                    {
                        continue;                        //skip thumbs.db
                    }
                    DateTime dtCreated = File.GetCreationTime(files[f]);
                    if (dtCreated.AddDays(7).Date < DateTime.Today)
                    {
                        File.Delete(files[f]);
                    }
                }
                datePurged = DateTime.Today;
            }
            //create the image-----------------------------------------------------------------
            Point origin = new Point(0, 0);
            int   right  = 0;
            int   bottom = 0;

            //all screens together form a giant image.  We just need to know where origin is as well as size.
            for (int s = 0; s < System.Windows.Forms.Screen.AllScreens.Length; s++)
            {
                if (System.Windows.Forms.Screen.AllScreens[s].WorkingArea.X < origin.X ||
                    System.Windows.Forms.Screen.AllScreens[s].WorkingArea.Y < origin.Y)
                {
                    //screen must be to top or left of primary.  Use its origin.
                    origin = new Point(System.Windows.Forms.Screen.AllScreens[s].WorkingArea.X, System.Windows.Forms.Screen.AllScreens[s].WorkingArea.Y);
                }
                if (System.Windows.Forms.Screen.AllScreens[s].WorkingArea.X + System.Windows.Forms.Screen.AllScreens[s].WorkingArea.Width > right)
                {
                    //screen must be to right of primary.  Use its right-most extension.
                    right = System.Windows.Forms.Screen.AllScreens[s].WorkingArea.X + System.Windows.Forms.Screen.AllScreens[s].WorkingArea.Width;
                }
                if (System.Windows.Forms.Screen.AllScreens[s].WorkingArea.Y + System.Windows.Forms.Screen.AllScreens[s].WorkingArea.Height > bottom)
                {
                    //screen must be to bottom of primary.  Use its bottom-most extension.
                    bottom = System.Windows.Forms.Screen.AllScreens[s].WorkingArea.Y + System.Windows.Forms.Screen.AllScreens[s].WorkingArea.Height;
                }
            }
            //calculate total width and height, remembering that origin can be negative
            Size   sizeAllScreens = new Size(right - origin.X, bottom - origin.Y);   //example 100-(-20)=120, or 100-20=80.
            Bitmap bmp            = new Bitmap(sizeAllScreens.Width, sizeAllScreens.Height);

            using (Graphics g = Graphics.FromImage(bmp)) {
                g.CopyFromScreen(origin, new Point(0, 0), sizeAllScreens);
            }
            //save the image----------------------------------------------------------------------
            //I tried a variety of file types.  The resulting file sizes were very similar.
            string filename = folder + "\\" + DateTime.Now.ToString("yyyy-MM-dd-HHmmssff") + ".jpg";

            bmp.Save(filename);
            //make a thumbnail with height of 50
            int      thumbW   = (int)((double)bmp.Width / (double)bmp.Height * 50d);
            Bitmap   bmpThumb = new Bitmap(thumbW, 50);
            Graphics gThumb   = Graphics.FromImage(bmpThumb);

            gThumb.DrawImage(bmp, 0, 0, thumbW, 50);
            gThumb.Dispose();
            gThumb = null;
            Phones.SetScreenshot(extension, filename, bmpThumb);          //IpAddress192,bitmapSmall,Environment.MachineName);
        }
Exemple #11
0
 public bool update(Phones Phones)
 {
     return(_phoneDal.update(Phones));
 }
Exemple #12
0
 public bool add(Phones Phones)
 {
     return(_phoneDal.add(Phones));
 }
Exemple #13
0
 /// <summary>
 /// Telefon Numarası Ekler
 /// </summary>
 /// <param name="phone">Eklenecek Telefon Numarası</param>
 public void PutPhone(Phones phone)
 {
     db.Phones.Add(phone);
     db.SaveChanges();
 }
Exemple #14
0
        public virtual void AddFields(IEnumerable <Field> fields)
        {
            if (fields == null)
            {
                return;
            }

            // Add the fields to their corresponding container.
            foreach (Field field in fields)
            {
                if (field.GetType() == typeof(Data.Fields.Name))
                {
                    Names.Add((Data.Fields.Name)field);
                }
                else if (field.GetType() == typeof(Address))
                {
                    Addresses.Add((Address)field);
                }
                else if (field.GetType() == typeof(Phone))
                {
                    Phones.Add((Phone)field);
                }
                else if (field.GetType() == typeof(Email))
                {
                    Emails.Add((Email)field);
                }
                else if (field.GetType() == typeof(Job))
                {
                    Jobs.Add((Job)field);
                }
                else if (field.GetType() == typeof(Education))
                {
                    Educations.Add((Education)field);
                }
                else if (field.GetType() == typeof(Image))
                {
                    Images.Add((Image)field);
                }
                else if (field.GetType() == typeof(Username))
                {
                    Usernames.Add((Username)field);
                }
                else if (field.GetType() == typeof(UserID))
                {
                    UserIDs.Add((UserID)field);
                }
                else if (field.GetType() == typeof(DOB))
                {
                    DOB = (DOB)field;
                }
                else if (field.GetType() == typeof(Gender))
                {
                    Gender = (Gender)field;
                }
                else if (field.GetType() == typeof(Language))
                {
                    Languages.Add((Language)field);
                }
                else if (field.GetType() == typeof(Ethnicity))
                {
                    Ethnicities.Add((Ethnicity)field);
                }
                else if (field.GetType() == typeof(OriginCountry))
                {
                    OriginCountries.Add((OriginCountry)field);
                }
                else if (field.GetType() == typeof(URL))
                {
                    Urls.Add((URL)field);
                }
            }
        }
Exemple #15
0
 public SmsDto(string phone, string message, SmsOptions options)
 {
     Phones.Add(phone);
     Message = message;
     Options = options;
 }
Exemple #16
0
 ///<summary>Set phone and triage flag to display. Get/Set accessor won't work here because we require 2 seperate fields in order to update the control properly.</summary>
 public void SetPhone(Phone phone, PhoneEmpDefault phoneEmpDefault, ChatUser chatUserCur, bool isTriageOperator)
 {
     _phoneCur = phone;
     if (_phoneCur == null)                      //empty out everything and return
     {
         pictureInUse.Visible           = false; //pictureInUse.Visible=false;
         labelStatusAndNote.Text        = "";
         pictureProx.Visible            = false;
         labelExtensionName.Text        = "";
         labelTime.Text                 = "";
         labelTime.BackColor            = this.BackColor;
         pictureNeedsHelpButton.Visible = false;
         pictureGTA.Visible             = false;
         labelCustomer.Text             = "Invalid Comp or Phone";
         return;
     }
     pictureInUse.Visible = _phoneCur.Description != "";
     //Check if the user is logged in.
     if (_phoneCur.ClockStatus == ClockStatusEnum.Home ||
         _phoneCur.ClockStatus == ClockStatusEnum.None ||
         _phoneCur.ClockStatus == ClockStatusEnum.Off)
     {
         labelStatusAndNote.Text = "Clock In";
     }
     else
     {
         labelStatusAndNote.Text = _phoneCur.ClockStatus.GetDescription();
     }
     //Always show ext and name, no matter if user is clocked in or not. This keeps phone tiles from appearing blank with no extension and name.
     if (_phoneCur.EmployeeName != "")
     {
         labelExtensionName.Text = _phoneCur.Extension.ToString() + " - " + _phoneCur.EmployeeName;
     }
     else
     {
         labelExtensionName.Text = _phoneCur.Extension.ToString() + " - Vacant";
     }
     if (_phoneCur.DateTimeNeedsHelpStart.Date == DateTime.Today)
     {
         labelTime.Text = (DateTime.Now - _phoneCur.DateTimeNeedsHelpStart + TimeDelta).ToStringHmmss();
     }
     else if (_phoneCur.DateTimeStart.Date == DateTime.Today)
     {
         labelTime.Text = (DateTime.Now - _phoneCur.DateTimeStart + TimeDelta).ToStringHmmss();
     }
     else
     {
         labelTime.Text = "";
     }
     if (_phoneCur.ClockStatus == ClockStatusEnum.Home ||
         _phoneCur.ClockStatus == ClockStatusEnum.None ||
         _phoneCur.ClockStatus == ClockStatusEnum.Break)
     {
         labelTime.BackColor = this.BackColor;              //No color if employee is not currently working.
         pictureNeedsHelpButton.BackColor = this.BackColor; //No color if employee is not currently working.
     }
     else
     {
         Color outerColor;
         Color innerColor;
         Color fontColor;
         bool  isTriageOperatorOnTheClock = false;
         //get the cubicle color and triage status
         Phones.GetPhoneColor(phone, phoneEmpDefault, false, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
         if (!timerFlash.Enabled)
         {
             //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
             Phones.PhoneColorScheme colorScheme = new Phones.PhoneColorScheme(true);
             labelTime.BackColor = outerColor;
             if (phone.ClockStatus == ClockStatusEnum.HelpOnTheWay)
             {
                 labelTime.BackColor = colorScheme.ColorOuterNeedsHelp;
             }
             if (_phoneCur.ClockStatus == ClockStatusEnum.NeedsHelp)
             {
                 //Only start the flash timer and color the control once. This prevents over-flashing effect.
                 labelTime.Tag = new object[2] {
                     false, colorScheme.ColorOuterNeedsHelp
                 };                                                                                           // labelTime.BackColor };
                 timerFlash.Start();
             }
         }
     }
     if (_phoneCur.ClockStatus != ClockStatusEnum.NeedsHelp)            //Always assume the flash timer was previously turned on and turn it off here. No harm if it' already off.
     {
         timerFlash.Stop();
     }
     if (_phoneCur.ClockStatus == ClockStatusEnum.Home ||
         _phoneCur.ClockStatus == ClockStatusEnum.None)
     {
         labelTime.BorderStyle = System.Windows.Forms.BorderStyle.None;              //Remove color box if employee is not currently working.
     }
     else
     {
         labelTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     }
     labelCustomer.Text = _phoneCur.CustomerNumber;
     //Always show ext and name, no matter if user is clocked in or not. This keeps phone tiles from appearing blank with no extension and name.
     if (_phoneCur.EmployeeName != "")
     {
         labelExtensionName.Text = _phoneCur.Extension.ToString() + " - " + _phoneCur.EmployeeName;           // +(IsProximal ? " "+_cPerson : "");
     }
     else
     {
         labelExtensionName.Text = _phoneCur.Extension.ToString() + " - Vacant";
     }
     pictureProx.Visible = true;
     if (phone.IsProxVisible)
     {
         pictureProx.Image = Properties.Resources.Figure;
     }
     else if (phone.DateTProximal.AddHours(8) > DateTime.Now)
     {
         pictureProx.Image = Properties.Resources.NoFigure;              //TODO: replace image with one from Nathan
     }
     else
     {
         pictureProx.Visible = false;
     }
     if (LayoutHorizontal)
     {
         this.labelExtensionName.Location = new Point(3, 9);
         pictureProx.Location             = new Point(173, 11);
     }
     else
     {
         int stringW   = TextRenderer.MeasureText(labelExtensionName.Text, labelExtensionName.Font).Width;
         int locationX = labelExtensionName.Location.X
                         + stringW
                         + (labelExtensionName.Width - stringW) / 2 //half of the unused space around the centered text
                         + 1;                                       //padding
         pictureProx.Location           = new Point(locationX, 6);
         pictureNeedsHelpButton.Visible = true;
     }
     if (phone.ClockStatus == ClockStatusEnum.Home ||
         phone.ClockStatus == ClockStatusEnum.Lunch ||
         phone.ClockStatus == ClockStatusEnum.Break ||
         phone.ClockStatus == ClockStatusEnum.None)
     {
         pictureNeedsHelpButton.Visible = false;
     }
     else
     {
         pictureNeedsHelpButton.Enabled = true;
         pictureNeedsHelpButton.Image   = Properties.Resources.raisehanddisabled;
     }
     if (chatUserCur == null || chatUserCur.CurrentSessions == 0 || pictureInUse.Visible)
     {
         pictureGTA.Visible = false;
         pictureGTA.SendToBack();
     }
     else
     {
         pictureGTA.Visible = true;
         pictureGTA.BringToFront();
         labelTime.Text = TimeSpan.FromMilliseconds(chatUserCur.SessionTime).ToStringHmmss();
     }
 }
Exemple #17
0
 public SmsDto(IEnumerable <string> phones, string message, SmsOptions options)
 {
     Phones.AddRange(phones);
     Message = message;
     Options = options;
 }
Exemple #18
0
 public void RemovePhones(Phone obj)
 {
     Phones.Remove(obj);
 }
Exemple #19
0
 public void AddPhone(String PhoneNumber)
 {
     Phones.Add(PhoneNumber);
 }
 public IEnumerable <Phone> GetPhones()
 {
     return(Phones.Select(x => x.Phone));
 }
 public CompositeEditableModel(string location, IEnumerable <int> phones)
 {
     Location = location;
     _person  = new SimpleEditableModel();
     Phones.AddRange(phones);
 }
Exemple #22
0
 ///<summary>Refresh the phone panel every X seconds after it has already been setup.  Make sure to call FillMapAreaPanel before calling this the first time.</summary>
 public void SetPhoneList(List <PhoneEmpDefault> peds, List <Phone> phones, List <PhoneEmpSubGroup> listSubGroups, List <ChatUser> listChatUsers)
 {
     try {
         string title = "Call Center Map - Triage Coord. - ";
         try {                 //get the triage coord label but don't fail just because we can't find it
             SiteLink siteLink = SiteLinks.GetFirstOrDefault(x => x.SiteNum == _mapCur.SiteNum);
             title += Employees.GetNameFL(Employees.GetEmp(siteLink.EmployeeNum));
         }
         catch {
             title += "Not Set";
         }
         labelTriageCoordinator.Text = title;
         labelCurrentTime.Text       = DateTime.Now.ToShortTimeString();
         #region Triage Counts
         //The triage count used to only count up the triage operators within the currently selected room.
         //Now we want to count all operators at the selected site (local) and then all operators across all sites (total).
         int triageStaffCountLocal = 0;
         int triageStaffCountTotal = 0;
         foreach (PhoneEmpDefault phoneEmpDefault in peds.FindAll(x => x.IsTriageOperator && x.HasColor))
         {
             Phone phone = phones.FirstOrDefault(x => x.Extension == phoneEmpDefault.PhoneExt);
             if (phone == null)
             {
                 continue;
             }
             if (phone.ClockStatus.In(ClockStatusEnum.None, ClockStatusEnum.Home, ClockStatusEnum.Lunch, ClockStatusEnum.Break, ClockStatusEnum.Off
                                      , ClockStatusEnum.Unavailable, ClockStatusEnum.NeedsHelp, ClockStatusEnum.HelpOnTheWay))
             {
                 continue;
             }
             //This is a triage operator who is currently here and on the clock.
             if (phoneEmpDefault.SiteNum == _mapCur.SiteNum)
             {
                 triageStaffCountLocal++;
             }
             triageStaffCountTotal++;
         }
         labelTriageOpsCountLocal.Text = triageStaffCountLocal.ToString();
         labelTriageOpsCountTotal.Text = triageStaffCountTotal.ToString();
         #endregion
         for (int i = 0; i < this.mapAreaPanelHQ.Controls.Count; i++)            //loop through all of our cubicles and labels and find the matches
         {
             try {
                 if (!(this.mapAreaPanelHQ.Controls[i] is MapAreaRoomControl))
                 {
                     continue;
                 }
                 MapAreaRoomControl room = (MapAreaRoomControl)this.mapAreaPanelHQ.Controls[i];
                 if (room.MapAreaItem.Extension == 0)                        //This cubicle has not been given an extension yet.
                 {
                     room.Empty = true;
                     continue;
                 }
                 Phone phone = Phones.GetPhoneForExtension(phones, room.MapAreaItem.Extension);
                 if (phone == null)                       //We have a cubicle with no corresponding phone entry.
                 {
                     room.Empty = true;
                     continue;
                 }
                 room.PhoneCur = phone;                      //Refresh PhoneCur so that it has up to date customer information.
                 ChatUser        chatuser        = listChatUsers.Where(x => x.Extension == phone.Extension).FirstOrDefault();
                 PhoneEmpDefault phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, peds);
                 if (phoneEmpDefault == null)                       //We have a cubicle with no corresponding phone emp default entry.
                 {
                     room.Empty = true;
                     continue;
                 }
                 //we got this far so we found a corresponding cubicle for this phone entry
                 room.EmployeeNum  = phone.EmployeeNum;
                 room.EmployeeName = phone.EmployeeName;
                 if (phone.DateTimeNeedsHelpStart.Date == DateTime.Today)                        //if they need help, use that time.
                 {
                     TimeSpan span      = DateTime.Now - phone.DateTimeNeedsHelpStart + _timeDelta;
                     DateTime timeOfDay = DateTime.Today + span;
                     room.Elapsed = timeOfDay.ToString("H:mm:ss");
                 }
                 else if (phone.DateTimeStart.Date == DateTime.Today && phone.Description != "")                        //else if in a call, use call time.
                 {
                     TimeSpan span      = DateTime.Now - phone.DateTimeStart + _timeDelta;
                     DateTime timeOfDay = DateTime.Today + span;
                     room.Elapsed = timeOfDay.ToString("H:mm:ss");
                 }
                 else if (phone.Description == "" && chatuser != null && chatuser.CurrentSessions > 0)                    //else if in a chat, use chat time.
                 {
                     TimeSpan span = TimeSpan.FromMilliseconds(chatuser.SessionTime) + _timeDelta;
                     room.Elapsed = span.ToStringHmmss();
                 }
                 else if (phone.DateTimeStart.Date == DateTime.Today)                        //else available, use that time.
                 {
                     TimeSpan span      = DateTime.Now - phone.DateTimeStart + _timeDelta;
                     DateTime timeOfDay = DateTime.Today + span;
                     room.Elapsed = timeOfDay.ToString("H:mm:ss");
                 }
                 else                           //else, whatever.
                 {
                     room.Elapsed = "";
                 }
                 if (phone.IsProxVisible)
                 {
                     room.ProxImage = Properties.Resources.Figure;
                 }
                 else if (phone.DateTProximal.AddHours(8) > DateTime.Now)
                 {
                     room.ProxImage = Properties.Resources.NoFigure;                          //TODO: replace image with one from Nathan
                 }
                 else
                 {
                     room.ProxImage = null;
                 }
                 room.IsAtDesk = phone.IsProxVisible;
                 string status = Phones.ConvertClockStatusToString(phone.ClockStatus);
                 //Check if the user is logged in.
                 if (phone.ClockStatus == ClockStatusEnum.None ||
                     phone.ClockStatus == ClockStatusEnum.Home)
                 {
                     status = "Home";
                 }
                 room.Status = status;
                 if (phone.Description == "")
                 {
                     room.PhoneImage = null;
                     if (chatuser != null && chatuser.CurrentSessions != 0)
                     {
                         room.ChatImage = Properties.Resources.gtaicon3;
                     }
                     else
                     {
                         room.ChatImage = null;
                     }
                 }
                 else
                 {
                     room.PhoneImage = Properties.Resources.phoneInUse;
                 }
                 Color outerColor;
                 Color innerColor;
                 Color fontColor;
                 bool  isTriageOperatorOnTheClock;
                 //get the cubicle color and triage status
                 Phones.GetPhoneColor(phone, phoneEmpDefault, true, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
                 if (!room.IsFlashing)                          //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
                 {
                     room.OuterColor = outerColor;
                     room.InnerColor = innerColor;
                 }
                 room.ForeColor = fontColor;
                 if (phone.ClockStatus == ClockStatusEnum.NeedsHelp)                        //turn on flashing
                 {
                     room.StartFlashing();
                 }
                 else                           //turn off flashing
                 {
                     room.StopFlashing();
                 }
                 room.Invalidate(true);
             }
             catch (Exception e) {
                 e.DoNothing();
             }
         }
         refreshCurrentTabHelper(peds, phones, listSubGroups);
     }
     catch {
         //something failed unexpectedly
     }
 }
Exemple #23
0
        private void MapAreaRoomControl_MouseUp(object sender, MouseEventArgs e)
        {
            if (!_allowClickOptions)
            {
                return;                //disable click options in setup window.
            }
            if (e == null || e.Button != MouseButtons.Right)
            {
                if (e.Button == MouseButtons.Left && !IsFlashing && Status != "OnWay")
                {
                    if (_rectName.Contains(e.Location))
                    {
                        PhoneUI.EmployeeSettings(_phoneCur);
                        return;
                    }
                    if (_rectPhone.Contains(e.Location) && _phoneCur.PatNum != 0)
                    {
                        OnGoToChanged();
                    }
                }
                return;
            }
            bool allowStatusEdit = ClockEvents.IsClockedIn(EmployeeNum);

            if (EmployeeNum == Security.CurUser.EmployeeNum)           //can always edit yourself
            {
                allowStatusEdit = true;
            }
            if (Status == Phones.ConvertClockStatusToString(ClockStatusEnum.NeedsHelp))
            {
                //Always allow any employee to change any other employee from NeedsAssistance to Available
                allowStatusEdit = true;
            }
            string statusOnBehalfOf      = EmployeeName;
            bool   allowSetSelfAvailable = false;

            if (!ClockEvents.IsClockedIn(EmployeeNum) &&         //No one is clocked in at this extension.
                !ClockEvents.IsClockedIn(Security.CurUser.EmployeeNum))                    //This user is not clocked in either.
            {
                //Vacant extension and this user is not clocked in so allow this user to clock in at this extension.
                statusOnBehalfOf      = Security.CurUser.UserName;
                allowSetSelfAvailable = true;
            }
            AddToolstripGroup("menuItemStatusOnBehalf", "Status for: " + statusOnBehalfOf);
            AddToolstripGroup("menuItemRingGroupOnBehalf", "Queues for ext: " + Extension.ToString());
            AddToolstripGroup("menuItemClockOnBehalf", "Clock event for: " + EmployeeName);
            AddToolstripGroup("menuItemCustomer", "Customer: " + _phoneCur.CustomerNumber);
            AddToolstripGroup("menuItemEmployee", "Employee: " + EmployeeName);
            SetToolstripItemText("menuItemAvailable", allowStatusEdit || allowSetSelfAvailable);
            SetToolstripItemText("menuItemTraining", allowStatusEdit);
            SetToolstripItemText("menuItemTeamAssist", allowStatusEdit);
            SetToolstripItemText("menuItemNeedsHelp", allowStatusEdit);
            SetToolstripItemText("menuItemWrapUp", allowStatusEdit);
            SetToolstripItemText("menuItemOfflineAssist", allowStatusEdit);
            SetToolstripItemText("menuItemUnavailable", allowStatusEdit);
            SetToolstripItemText("menuItemTCResponder", allowStatusEdit);
            SetToolstripItemText("menuItemBackup", allowStatusEdit);
            SetToolstripItemText("menuItemLunch", allowStatusEdit);
            SetToolstripItemText("menuItemHome", allowStatusEdit);
            SetToolstripItemText("menuItemBreak", allowStatusEdit);
            menuItemGoTo.Enabled = true;
            if (_phoneCur.PatNum == 0)           //disable go to if not a current patient
            {
                menuItemGoTo.Enabled = false;
            }
            Point p = new Point(Location.X + e.Location.X, Location.Y + e.Location.Y);

            menuStatus.Show(Cursor.Position);
        }
Exemple #24
0
 internal void AddPhone()
 {
     Phones.Add(new Phone("Телефон", Phones.Count));
 }
Exemple #25
0
 public void AddPhone(Pair <Guid, Pair <string, string> > phone)
 {
     Phones.Add(phone);
 }
Exemple #26
0
        ///<summary>Set phone and triage flag to display. Get/Set accessor won't work here because we require 2 seperate fields in order to update the control properly.</summary>
        public void SetPhone(Phone phone, PhoneEmpDefault phoneEmpDefault, bool isTriageOperator)
        {
            phoneCur = phone;
            if (phoneCur == null)            //empty out everything and return
            {
                this.Visible            = false;
                pictureWebCam.Image     = null;          //or just make it not visible?
                pictureInUse.Visible    = false;
                labelExtensionName.Text = "";
                labelStatusAndNote.Text = "";
                labelTime.Text          = "";
                labelTime.BackColor     = this.BackColor;
                labelCustomer.Text      = "";
                return;
            }
            this.Visible = true;
            if (ShowImageForced)
            {
                pictureWebCam.Image   = PIn.Bitmap(phoneCur.WebCamImage);
                pictureWebCam.Visible = true;
            }
            else if (phoneCur.ClockStatus == ClockStatusEnum.Home ||
                     phoneCur.ClockStatus == ClockStatusEnum.None ||
                     phoneCur.ClockStatus == ClockStatusEnum.Off)
            {
                pictureWebCam.Image   = null;
                pictureWebCam.Visible = false;
            }
            else if (phoneCur.ClockStatus == ClockStatusEnum.Break ||
                     phoneCur.ClockStatus == ClockStatusEnum.Lunch)
            {
                pictureWebCam.Visible = true;
                Bitmap   bmp = new Bitmap(pictureWebCam.Width, pictureWebCam.Height);
                Graphics g   = Graphics.FromImage(bmp);
                try {
                    g.FillRectangle(SystemBrushes.Control, 0, 0, bmp.Width, bmp.Height);
                    string strStat = phoneCur.ClockStatus.ToString();
                    SizeF  sizef   = g.MeasureString(strStat, labelStatusAndNote.Font);
                    g.DrawString(strStat, labelStatusAndNote.Font, SystemBrushes.GrayText, (bmp.Width - sizef.Width) / 2, (bmp.Height - sizef.Height) / 2);
                    pictureWebCam.Image = (Image)bmp.Clone();
                }
                finally {
                    g.Dispose();
                    g = null;
                    bmp.Dispose();
                    bmp = null;
                }
            }
            else
            {
                pictureWebCam.Visible = true;
                pictureWebCam.Image   = PIn.Bitmap(phoneCur.WebCamImage);
            }
            if (phoneCur.Description == "")
            {
                pictureInUse.Visible = false;
            }
            else
            {
                pictureInUse.Visible = true;
            }
            labelExtensionName.Text = "";
            string str = phoneCur.ClockStatus.ToString();

            //Check if the user is logged in.
            if (phoneCur.ClockStatus == ClockStatusEnum.None ||
                phoneCur.ClockStatus == ClockStatusEnum.Home)
            {
                str = "Clock In";
            }
            //Always show ext and name, no matter if user is clocked in or not. This keeps phone tiles from appearing blank with no extension and name.
            string nameStr = "Vacant";

            if (phoneCur.EmployeeName != "")
            {
                nameStr = phoneCur.EmployeeName;
            }
            labelExtensionName.Text = phoneCur.Extension.ToString() + " - " + nameStr;
            labelStatusAndNote.Text = str;
            DateTime dateTimeStart = phoneCur.DateTimeStart;

            if (dateTimeStart.Date == DateTime.Today)
            {
                TimeSpan span      = DateTime.Now - dateTimeStart + TimeDelta;
                DateTime timeOfDay = DateTime.Today + span;
                labelTime.Text = timeOfDay.ToString("H:mm:ss");
            }
            else
            {
                labelTime.Text = "";
            }
            if (phoneCur.ClockStatus == ClockStatusEnum.Home ||
                phoneCur.ClockStatus == ClockStatusEnum.None ||
                phoneCur.ClockStatus == ClockStatusEnum.Break)
            {
                labelTime.BackColor = this.BackColor;              //No color if employee is not currently working.
            }
            else
            {
                Color outerColor;
                Color innerColor;
                Color fontColor;
                bool  isTriageOperatorOnTheClock = false;
                //get the cubicle color and triage status
                Phones.GetPhoneColor(phone, phoneEmpDefault, false, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
                if (!timerFlash.Enabled)                  //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
                {
                    labelTime.BackColor = outerColor;
                }
                if (phoneCur.ClockStatus == ClockStatusEnum.NeedsHelp)
                {
                    if (!timerFlash.Enabled)                      //Only start the flash timer and color the control once. This prevents over-flashing effect.
                    {
                        labelTime.Tag = new object[2] {
                            false, labelTime.BackColor
                        };
                        timerFlash.Start();
                    }
                }
            }
            if (phoneCur.ClockStatus == ClockStatusEnum.Home ||
                phoneCur.ClockStatus == ClockStatusEnum.None)
            {
                labelTime.BorderStyle = System.Windows.Forms.BorderStyle.None;              //Remove color box if employee is not currently working.
            }
            else
            {
                labelTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            }
            if (phoneCur.ClockStatus != ClockStatusEnum.NeedsHelp)            //Always assume the flash timer was previously turned on and turn it off here. No harm if it' already off.
            {
                timerFlash.Stop();
            }
            labelCustomer.Text = phoneCur.CustomerNumber;
        }
Exemple #27
0
 public void DeletePhoneById(Guid id)
 {
     Phones.Remove(this.SearchPhoneById(id));
 }
Exemple #28
0
 public void Delete(Phones entity)
 {
     _phonesDal.Delete(entity);
 }
Exemple #29
0
 public Pair <Guid, Pair <string, string> > SearchPhoneById(Guid id)
 {
     return(Phones.Find(phone => new Guid(phone.Key.ToString()) == id));
 }
Exemple #30
0
        public async Task <EntityResult <PersonCreatedDto> > Handle(InsertPersonRequest request, CancellationToken cancellationToken)
        {
            PersonValidator  validator = new PersonValidator(_context);
            ValidationResult result    = await validator.ValidateAsync(request);

            if (!result.IsValid)
            {
                foreach (var item in result.Errors)
                {
                    request.AddNotification(item.PropertyName, item.ErrorMessage);
                }

                return(new EntityResult <PersonCreatedDto>(request.Notifications, result.Errors.All(err => err.ErrorCode == ErrorCode.NotFound.ToString()) ? ErrorCode.NotFound : ErrorCode.BadRequest));
            }

            NaturalPersons naturalPerson = new NaturalPersons()
            {
                FirstName      = request.NaturalPerson.FirstName,
                LastName       = request.NaturalPerson.LastName,
                LastNamePrefix = request.NaturalPerson.LastNamePrefix,
                FullName       = request.NaturalPerson.FullName,
                BirthDate      = request.NaturalPerson.BirthDate,
                DateOfDeath    = (request.NaturalPerson.DateOfDeath.Equals(null)) ? null : new DateTime?(Convert.ToDateTime(request.NaturalPerson.DateOfDeath)),
                MaritalStatus  = (request.NaturalPerson.MaritalStatus != 0) ? request.NaturalPerson.MaritalStatus : new int?(),
                Nationality    = request.NaturalPerson.Nationality,
                Gender         = request.NaturalPerson.Gender,
                Alias          = request.NaturalPerson.Alias
            };

            List <Incomes> incomes = new List <Incomes>();

            foreach (var i in request.Income)
            {
                var income = new Incomes
                {
                    Value       = i.Value,
                    Currency    = i.Currency,
                    Company     = i.Company,
                    Periodicity = (i.Periodicity != 0) ? i.Periodicity : new int?(),
                    ValidFrom   = i.ValidFrom,
                    ValidTo     = (i.ValidTo.Equals(null)) ? null : new DateTime?(Convert.ToDateTime(i.ValidTo)),
                };
                incomes.Add(income);
            }

            List <Address> addresses = new List <Address>();

            if (!request.Address.Equals(null))
            {
                foreach (var a in request.Address)
                {
                    var address = new Address
                    {
                        City              = (a.City != 0) ? a.City : new int?(),
                        PostCode          = a.PostCode,
                        StreetName        = a.StreetName,
                        BuildingNumber    = a.BuildingNumber,
                        AddressLine       = a.AddressLine,
                        Latitude          = a.Latitude,
                        Longitude         = a.Longitude,
                        AddressType       = a.AddressType,
                        PostOfficeBoxCode = a.PostOfficeBoxCode,
                        PoboxPostalCode   = a.PoboxPostalCode,
                        StatusCodeAddress = (a.StatusCodeAddress != 0) ? a.StatusCodeAddress : new int?(),
                        Coname            = a.Coname,
                        ValidFrom         = a.ValidFrom,
                        ValidTo           = (a.ValidTo.Equals(null)) ? null : new DateTime?(Convert.ToDateTime(a.ValidTo)),
                        Neighborhood      = a.Neighborhood
                    };

                    addresses.Add(address);
                }
            }

            List <IdentificationsDocuments> identificationDocuments = new List <IdentificationsDocuments>();

            if (!request.IdentificationDocument.Equals(null))
            {
                foreach (var i in request.IdentificationDocument)
                {
                    var d = new IdentificationsDocuments
                    {
                        DocumentNumber             = i.DocumentNumber,
                        IssuingDate                = (i.IssuingDate.Equals(null)) ? null : new DateTime?(Convert.ToDateTime(i.IssuingDate)),
                        IssuingAuthority           = i.IssuingAuthority,
                        ExpiryDate                 = (i.ExpiryDate.Equals(null)) ? null : new DateTime?(Convert.ToDateTime(i.ExpiryDate)),
                        ValidFrom                  = i.ValidFrom,
                        ValidTo                    = (i.ValidTo.Equals(null)) ? null : new DateTime?(Convert.ToDateTime(i.ValidTo)),
                        IdentificationDocumentType = i.IdentificationDocumentType
                    };
                    identificationDocuments.Add(d);
                }
                ;
            }

            List <Attachments> attachments = new List <Attachments>();

            if (!request.Attachment.Equals(null))
            {
                foreach (var a in request.Attachment)
                {
                    var attachment = new Attachments
                    {
                        FileName       = a.FileName,
                        Notes          = a.Notes,
                        AttachmentType = a.AttachmentType,
                        OwnerKey       = a.OwnerKey,
                        FileSize       = a.FileSize,
                        Name           = a.Name,
                        EncodedKey     = a.EncodedKey,
                        Location       = a.Location,
                    };
                    attachments.Add(attachment);
                }
            }
            List <Emails> emails = new List <Emails>();

            if (!request.Email.Equals(null))
            {
                foreach (var e in request.Email)
                {
                    var email = new Emails
                    {
                        EmailAddress = e.EmailAddress,
                        Validated    = e.Validated,
                        ValidFrom    = e.ValidFrom,
                        ValidTo      = (e.ValidTo.Equals(null)) ? null : new DateTime?(Convert.ToDateTime(e.ValidTo)),
                    };
                    emails.Add(email);
                }
                ;
            }

            List <Phones> phones = new List <Phones>();

            if (!request.Phone.Equals(null))
            {
                foreach (var f in request.Phone)
                {
                    var phone = new Phones
                    {
                        CountryIsoCode = f.CountryIsoCode,
                        AreaCode       = f.AreaCode,
                        PhoneNumber    = f.PhoneNumber,
                        Extension      = f.Extension,
                        PhoneType      = f.PhoneType,
                        ValidFrom      = f.ValidFrom,
                        ValidTo        = (f.ValidTo.Equals(null)) ? null : new DateTime?(Convert.ToDateTime(f.ValidTo)),
                    };
                    phones.Add(phone);
                }
            }

            List <Roles> roles = new List <Roles>();

            foreach (var item in request.Rol)
            {
                var rol = new Roles
                {
                    RoleType  = item.RoleType,
                    ValidFrom = item.ValidFrom,
                    ValidTo   = (item.ValidTo.Equals(null)) ? null : new DateTime?(Convert.ToDateTime(item.ValidTo)),
                };
                roles.Add(rol);
            }

            Persons person = new Persons
            {
                PersonId                 = Guid.NewGuid(),
                TransactionId            = (request.Transaction == 0) ? new long() : request.Transaction,
                PersonNumber             = request.PersonNumber,
                Category                 = request.Category,
                Status                   = request.Status,
                NaturalPersons           = naturalPerson,
                Address                  = addresses,
                IdentificationsDocuments = identificationDocuments,
                Emails                   = emails,
                Phones                   = phones,
                Roles       = roles,
                Attachments = attachments,
                Incomes     = incomes
            };

            _context.Persons.Add(person);
            await _context.SaveChangesAsync(cancellationToken);

            return(new EntityResult <PersonCreatedDto>(request.Notifications, new PersonCreatedDto
            {
                PersonId = person.PersonId
            }));
        }
Exemple #31
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            //Using a switch statement in case we want special functionality for the other statuses later on.
            switch ((PhoneEmpStatusOverride)listStatusOverride.SelectedIndex)
            {
            case PhoneEmpStatusOverride.None:
                if (_pedOld.StatusOverride == PhoneEmpStatusOverride.Unavailable)
                {
                    MsgBox.Show(this, "Change your status from unavailable by using the small phone panel.");
                    return;
                }
                break;

            case PhoneEmpStatusOverride.OfflineAssist:
                if (_pedOld.StatusOverride == PhoneEmpStatusOverride.Unavailable)
                {
                    MsgBox.Show(this, "Change your status from unavailable by using the small phone panel.");
                    return;
                }
                break;
            }
            if (IsNew)
            {
                if (textEmployeeNum.Text == "")
                {
                    MsgBox.Show(this, "Unique EmployeeNum is required.");
                    return;
                }
                if (textEmpName.Text == "")
                {
                    MsgBox.Show(this, "Employee name is required.");
                    return;
                }
                PedCur.EmployeeNum = PIn.Long(textEmployeeNum.Text);
            }
            //Get the current database state of the phone emp default (before we change it)
            PhoneEmpDefault pedFromDatabase = PhoneEmpDefaults.GetOne(PedCur.EmployeeNum);

            if (pedFromDatabase == null)
            {
                pedFromDatabase = new PhoneEmpDefault();
            }
            else if (pedFromDatabase != null && IsNew)
            {
                MessageBox.Show("Employee Num already in use.\r\nEdit their current phone settings entry instead of creating a duplicate.");
                return;
            }
            int  newExtension    = PIn.Int(textPhoneExt.Text);
            bool extensionChange = pedFromDatabase.PhoneExt != newExtension;

            if (extensionChange)              //Only check when extension has changed and clocked in.
            //We need to prevent changes to phoneempdefault table which involve employees who are currently logged in.
            //Failing to do so would cause subtle race conditions between the phone table and phoneempdefault.
            //Net result would be the phone panel looking wrong.
            {
                if (ClockEvents.IsClockedIn(PedCur.EmployeeNum))                 //Prevent any change if employee being edited is currently clocked in.
                {
                    MsgBox.Show(this, "You must first clock out before making changes");
                    return;
                }
                //Find out if the target extension is already being occuppied by a different employee.
                Phone phoneOccuppied = Phones.GetPhoneForExtensionDB(PIn.Int(textPhoneExt.Text));
                if (phoneOccuppied != null)
                {
                    if (ClockEvents.IsClockedIn(phoneOccuppied.EmployeeNum))                      //Prevent change if employee's new extension is occupied by a different employee who is currently clocked in.
                    {
                        MessageBox.Show(Lan.g(this, "This extension cannot be inherited because it is currently occuppied by an employee who is currently logged in.\r\n\r\nExisting employee: ") + phoneOccuppied.EmployeeName);
                        return;
                    }
                    if (phoneOccuppied.EmployeeNum != PedCur.EmployeeNum)
                    {
                        //We are setting to a new employee so let's clean up the old employee.
                        //This will prevent duplicates in the phone table and subsequently prevent duplicates in the phone panel.
                        Phones.UpdatePhoneToEmpty(phoneOccuppied.EmployeeNum, -1);
                        PhoneEmpDefault pedOccuppied = PhoneEmpDefaults.GetOne(phoneOccuppied.EmployeeNum);
                        if (pedOccuppied != null)                       //prevent duplicate in phoneempdefault
                        {
                            pedOccuppied.PhoneExt = 0;
                            PhoneEmpDefaults.Update(pedOccuppied);
                        }
                    }
                }
                //Get the employee that is normally assigned to this extension (assigned ext set in the employee table).
                long permanentLinkageEmployeeNum = Employees.GetEmpNumAtExtension(pedFromDatabase.PhoneExt);
                if (permanentLinkageEmployeeNum >= 1)                      //Extension is nomrally assigned to an employee.
                {
                    if (PedCur.EmployeeNum != permanentLinkageEmployeeNum) //This is not the normally linked employee so let's revert back to the proper employee.
                    {
                        PhoneEmpDefault pedRevertTo = PhoneEmpDefaults.GetOne(permanentLinkageEmployeeNum);
                        //Make sure the employee we are about to revert is not logged in at yet a different workstation. This would be rare but it's worth checking.
                        if (pedRevertTo != null && !ClockEvents.IsClockedIn(pedRevertTo.EmployeeNum))
                        {
                            //Revert to the permanent extension for this PhoneEmpDefault.
                            pedRevertTo.PhoneExt = pedFromDatabase.PhoneExt;
                            PhoneEmpDefaults.Update(pedRevertTo);
                            //Update phone table to match this change.
                            Phones.SetPhoneStatus(ClockStatusEnum.Home, pedRevertTo.PhoneExt, pedRevertTo.EmployeeNum);
                        }
                    }
                }
            }
            //Ordering of these updates is IMPORTANT!!!
            //Phone Emp Default must be updated first
            PedCur.EmpName        = textEmpName.Text;
            PedCur.IsGraphed      = checkIsGraphed.Checked;
            PedCur.HasColor       = checkHasColor.Checked;
            PedCur.RingGroups     = (AsteriskQueues)listRingGroup.SelectedIndex;
            PedCur.PhoneExt       = PIn.Int(textPhoneExt.Text);
            PedCur.StatusOverride = (PhoneEmpStatusOverride)listStatusOverride.SelectedIndex;
            PedCur.Notes          = textNotes.Text;
            if (comboSite.SelectedIndex > -1)
            {
                PedCur.SiteNum = ((ODBoxItem <Site>)comboSite.SelectedItem).Tag.SiteNum;
            }
            PedCur.IsPrivateScreen  = true;         //we no longer capture screen shots.
            PedCur.IsTriageOperator = checkIsTriageOperator.Checked;
            if (IsNew)
            {
                PhoneEmpDefaults.Insert(PedCur);
                //insert a new Phone record to keep the 2 tables in sync an entry for the new extension in the phone table doesn't already exist.
                if (PedCur.PhoneExt != 0 && Phones.GetPhoneForExtensionDB(PedCur.PhoneExt) == null)
                {
                    Phone phoneNew = new Phone();
                    phoneNew.EmployeeName = PedCur.EmpName;
                    phoneNew.EmployeeNum  = PedCur.EmployeeNum;
                    phoneNew.Extension    = PedCur.PhoneExt;
                    phoneNew.ClockStatus  = ClockStatusEnum.Home;
                    Phones.Insert(phoneNew);
                }
            }
            else
            {
                PhoneEmpDefaults.Update(PedCur);
            }
            //It is now safe to update Phone table as it will draw from the newly updated Phone Emp Default row
            if ((PhoneEmpStatusOverride)listStatusOverride.SelectedIndex == PhoneEmpStatusOverride.Unavailable &&
                ClockEvents.IsClockedIn(PedCur.EmployeeNum))
            {
                //We set ourselves unavailable from this window because we require an explanation.
                //This is the only status that will synch with the phone table, all others should be handled by the small phone panel.
                Phones.SetPhoneStatus(ClockStatusEnum.Unavailable, PedCur.PhoneExt, PedCur.EmployeeNum);
            }
            if (extensionChange)
            {
                //Phone extension has changed so update the phone table as well.
                //We have already guaranteed that this employee is Clocked Out (above) so set to home and update phone table.
                Phones.SetPhoneStatus(ClockStatusEnum.Home, PedCur.PhoneExt, PedCur.EmployeeNum);
            }
            //The user just flagged themselves as a triage operator
            //OR
            //This user used to be a triage operator and they no longer want to be one which will need their ring group set back to their default.
            if ((!_pedOld.IsTriageOperator && checkIsTriageOperator.Checked) ||
                (_pedOld.IsTriageOperator && !checkIsTriageOperator.Checked))
            {
                //Set the queue for this phone emp default to whatever the current ClockStatus is for the phone row associated to this PED.
                PhoneAsterisks.SetQueueForClockStatus(PedCur);
            }
            DialogResult = DialogResult.OK;
        }
Exemple #32
0
        private void UserControlPhoneSmall_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.FillRectangle(SystemBrushes.Control, this.Bounds);
            if (phoneList == null)
            {
                return;
            }
            int   rows      = 7;
            int   columns   = 7;
            float boxWidth  = 21.4f;
            float boxHeight = 17f;
            float hTot      = boxHeight * rows;
            float x         = 0f;
            float y         = 0f;

            //Create a white "background" rectangle so that any empty squares (no employees) will show as white boxes instead of no color.
            g.FillRectangle(new SolidBrush(Color.White), x, y, boxWidth * columns, boxHeight * rows);
            for (int i = 0; i < phoneList.Count; i++)
            {
                //Draw the extension number if a person is available at that extension.
                if (phoneList[i].ClockStatus != ClockStatusEnum.Home &&
                    phoneList[i].ClockStatus != ClockStatusEnum.None)
                {
                    //Colors the box a color based on the corresponding phone's status.
                    Color outerColor;
                    Color innerColor;
                    Color fontColor;
                    bool  isTriageOperatorOnTheClock = false;
                    //get the cubicle color and triage status
                    PhoneEmpDefault ped = PhoneEmpDefaults.GetEmpDefaultFromList(phoneList[i].EmployeeNum, phoneEmpDefaultList);
                    Phones.GetPhoneColor(phoneList[i], ped, false, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
                    using (Brush brush = new SolidBrush(outerColor)) {
                        g.FillRectangle(brush, x * boxWidth, y * boxHeight, boxWidth, boxHeight);
                    }
                    Font  baseFont = new Font("Arial", 7);
                    SizeF extSize  = g.MeasureString(phoneList[i].Extension.ToString(), baseFont);
                    float padX     = (boxWidth - extSize.Width) / 2;
                    float padY     = (boxHeight - extSize.Height) / 2;
                    using (Brush brush = new SolidBrush(Color.Black)) {
                        g.DrawString(phoneList[i].Extension.ToString(), baseFont, brush, (x * boxWidth) + (padX), (y * boxHeight) + (padY));
                    }
                }
                x++;
                if (x >= columns)
                {
                    x = 0f;
                    y++;
                }
            }
            //horiz lines
            for (int i = 0; i < rows + 1; i++)
            {
                g.DrawLine(Pens.Black, 0, i * boxHeight, Width, i * boxHeight);
            }
            //Very bottom
            g.DrawLine(Pens.Black, 0, Height - 1, Width, Height - 1);
            //vert
            for (int i = 0; i < columns; i++)
            {
                g.DrawLine(Pens.Black, i * boxWidth, 0, i * boxWidth, hTot);
            }
            g.DrawLine(Pens.Black, Width - 1, 0, Width - 1, hTot);
        }
    protected void lnkbtnUpdate_Click(object sender, EventArgs e)
    {
       // int stateId = OrganizationInfo.getStateId(OrganizationID);
       //int  organizationIdWithSimilerEmail = OrganizationInfo.getOrganizationIdByEmail(txtPrimaryEmail.Text.Trim(), stateId);
       //if (organizationIdWithSimilerEmail > 0)
       //{
       //    lblemailalreadyexists.Text = "Email already exists for this state. Choose another";
       //    lblemailalreadyexists.Visible = true;
       //    return;
       //}
        DataTable dt = null;
        double stateId = OrganizationInfo.getStateId(OrganizationID);
        dt = OrganizationInfo.GetCityStateAndCountryByZipCode(txtZipCode.Text.Trim(), GlobalCountryID, stateId);

        if (dt.Rows.Count > 0)
        {
           
        }
        else
        {
            txtZipCode.Text = "";
            txtZipCode.Focus();
            lblBusinessZipCode.Text = "* Zipcode does not exist in this state.";
            return;
        }
        OrganizationInfo objOrg = new OrganizationInfo(OrganizationID);
        if (dddlcelltextmsgs.SelectedValue == "1")
            objOrg.CellAcceptTextMessages = true;
        else
            objOrg.CellAcceptTextMessages = false;
        if (ddlbusinesstextmsgs.SelectedValue == "1")
            objOrg.AcceptTextMessages = true;
        else
            objOrg.AcceptTextMessages = false;
        objOrg.OrganizationId = OrganizationID;
   //     objOrg.Fax = txtFax.Text.Trim();
 //       objOrg.Address = txtAddress.Text.Trim();
      //  objOrg.BusinessType = txtBusinessType.Text.Trim();
 //       objOrg.BillMailAddress = txtBillingMailAddress.Text.Trim();
  //      objOrg.BillingContact = txtBillingContact.Text.Trim();
 //       objOrg.CellExtension = txtCellPhoneExtension.Text.Trim();
        objOrg.LegalName = txtBusinessName.Text.Trim();
        objOrg.DBAName = txtDBAName.Text.Trim();
        objOrg.Website = txtWebsite.Text.Trim();
        objOrg.IsActive = true;
        objOrg.IsOrganization = true;
        objOrg.LanguageId =LanguageId;
        objOrg.ContactTitleName = txtContactTitle.Text.Trim();
        objOrg.RoleId = Conversion.ParseInt(UserInfo.UserRole.Stewardship);
        objOrg.UpdateOrganizationInfo();
        ContactInfo objPrimaryContact = new ContactInfo();

        objPrimaryContact.FirstName = txtFirstName.Text.Trim();
        objPrimaryContact.LastName = txtLastName.Text.Trim();
        objPrimaryContact.Email = txtPrimaryEmail.Text.Trim();
        
        objPrimaryContact.IsActive = true;
        objPrimaryContact.IsPrimary = true;
        objPrimaryContact.LanguageId = LanguageId;
        objPrimaryContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Business);
        
        Phones objPrimaryContactBusinessPhone = new Phones();

        objPrimaryContactBusinessPhone.Number =txtPhoneNumber.Text.Trim().ToString();
        objPrimaryContactBusinessPhone.Extension = txtPhoneExtension.Text.Trim().ToString();
        objPrimaryContactBusinessPhone.IsActive = true;
        objPrimaryContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

        Phones objPrimaryContactCellPhone = new Phones();

        objPrimaryContactCellPhone.Number = txtCellPhoneNumber.Text.Trim();
        objPrimaryContactCellPhone.IsActive = true;
        objPrimaryContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

        ContactInfo objBillingContact = new ContactInfo();
   //      objBillingContact.Email = txtBillingMailAddress.Text.Trim();
        objBillingContact.IsActive = true;
        objBillingContact.IsPrimary = false;
        objBillingContact.LanguageId = LanguageId;
        objBillingContact.ContactTypeId = Convert.ToInt32(ContactInfo.ContactTypes.Billing);
        objBillingContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Billing);

        Phones objBillingContactBusinessPhone = new Phones();
        objBillingContactBusinessPhone.IsActive = true;
        objBillingContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

        Phones objBillingContactCellPhone = new Phones();

        objBillingContactCellPhone.IsActive = true;
        objBillingContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

        OrganizationInfo.Organization_Address objBusinessOrganization_Address = new OrganizationInfo.Organization_Address();

        objBusinessOrganization_Address.ZipCodeID = Convert.ToInt32(hdnBusinessZipCodeId.Value);
        objBusinessOrganization_Address.ZipPostalCode = txtZipCode.Text.Trim().ToString();
        objBusinessOrganization_Address.Address1 = txtBusinessAddress1.Text.Trim();
        objBusinessOrganization_Address.Address2 = txtBusinessAddress2.Text.Trim();
       objBusinessOrganization_Address.City = txtCity.Text.Trim().ToString();
        objBusinessOrganization_Address.StateID = Convert.ToInt32(ddlState.SelectedValue);
        objBusinessOrganization_Address.CountryID = Convert.ToInt32(ddlCountry.SelectedValue);
        objBusinessOrganization_Address.DateCreated = DateTime.Now;
        objBusinessOrganization_Address.IsActive = true;
        objBusinessOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Business);

        OrganizationInfo.Organization_Address objMailingOrganization_Address = new OrganizationInfo.Organization_Address();
        objMailingOrganization_Address.DateCreated = DateTime.Now;
        objMailingOrganization_Address.IsActive = true;
        objMailingOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Mailing);

        OrganizationInfo.UpdateStewardshipInfo(objOrg, objPrimaryContact, objPrimaryContactBusinessPhone, objPrimaryContactCellPhone, objBillingContact, objBillingContactBusinessPhone, objBillingContactCellPhone, objBusinessOrganization_Address, objMailingOrganization_Address);
        lblinfo.Visible = true;
        lblinfo.Text = "Successfully updated";
        viewStakeholdersForApproval();
        pnlDisplay.Visible = true;
        pnlEdit.Visible = false;

    }
    /*

		private void UpdateData(int OrganizationId)
		{
			OrganizationInfo ObjOrg = new OrganizationInfo(OrganizationId);
			ObjOrg.Address = txtBusinessAddress1.Text;
			
			ObjOrg.BillMailAddress = txtMailingAddress1.Text;

			ObjOrg.BusinessType = new List<int>();

			ObjOrg.CountryID = Convert.ToInt32(ddlBusinessCountry.SelectedValue);
			ObjOrg.CountryName = ddlBusinessCountry.Text;

			ObjOrg.DBAName = txtDBAName.Text;

			ObjOrg.IsActive = true;
			ObjOrg.IsOrganization = true;

			ObjOrg.LegalName = txtBusinessLegalName.Text;
			ObjOrg.OwnerManager = txtPrimaryContactFirstName.Text;
			ObjOrg.StateID = Convert.ToInt32(ddlBusinessProvince.SelectedValue);
			ObjOrg.ZipPostalCode = txtBusinessZipCode.Text;

			OrganizationInfo.Supplier ObjOrgSupplier = ObjOrg.objSupplier;

			ObjOrgSupplier.BussinessPhone = txtSupplierBusinessPhone1.Text.Trim() + "-" + txtSupplierBusinessPhone2.Text.Trim() + "-" + txtSupplierBusinessPhone3.Text.Trim();
			ObjOrgSupplier.City = txtSupplierCity.Text;
			ObjOrgSupplier.CompanyName = txtSupplierCompanyName.Text;
			ObjOrgSupplier.ContactName = txtSupplierscontactName.Text;
			ObjOrgSupplier.CountryID = int.Parse(ddlSuppliersCountry.SelectedValue);
			ObjOrgSupplier.Email = txtSuppliersownerEmail.Text;
			ObjOrgSupplier.IsActive = true;
			ObjOrgSupplier.OwnerManagerEmail = txtSuppliersownerEmail.Text;
			ObjOrgSupplier.StateId = Convert.ToInt32(ddlSuppliersProvince.SelectedValue);

			ObjOrg.objSupplier = ObjOrgSupplier;

			OrganizationInfo.Client objOrgClient = ObjOrg.objClient;

			objOrgClient.BussinessPhone = txtClientBusinessPhone1.Text.Trim() + "-" + txtClientBusinessPhone2.Text.Trim() + "-" + txtClientBusinessPhone3.Text.Trim();
			objOrgClient.City = txtClientCity.Text;
			objOrgClient.CompanyName = txtclientsCompanyName.Text;
			objOrgClient.ContactName = txtclientsContactName.Text;
			objOrgClient.CountryID = int.Parse(ddlclientsCountry.SelectedValue);
			objOrgClient.IsActive = true;
			objOrgClient.OwnerManagerEmail = txtclientsEmail.Text;
			objOrgClient.StateId = Convert.ToInt32(ddlclientsProvince.SelectedValue);

			ObjOrg.objClient = objOrgClient;

			ObjOrg.ObjOrgBusiness = new List<OrganizationInfo.Organization_Business>();

			//OrganizationInfo.Organization_Business objOrgBusiness;

			//foreach (RepeaterItem rptItem in rptBusiness.Items)
			//{
			//    objOrgBusiness = new OrganizationInfo.Organization_Business();

			//    CheckBox chkY = (CheckBox)rptItem.FindControl("chkY");
			//    CheckBox chkN = (CheckBox)rptItem.FindControl("chkN");

			//    if (chkY.Checked || chkN.Checked)
			//    {
			//        objOrgBusiness.BusinessID = Convert.ToInt32(((HiddenField)rptItem.FindControl("hdnID")).Value);
			//        objOrgBusiness.IsNew = chkY.Checked;

			//        ObjOrg.ObjOrgBusiness.Add(objOrgBusiness);

			//    }
			//}

			ObjOrg.CertificationID = new List<int>();

			foreach (RepeaterItem rptItem in rptStakeCertificates.Items)
			{
				if (((CheckBox)rptItem.FindControl("chk")).Checked)
				{
					ObjOrg.CertificationID.Add(Convert.ToInt32(((HiddenField)rptItem.FindControl("hdnID")).Value));
				}
			}

			foreach (RepeaterItem rptItem in rptTireCertificates.Items)
			{
				if (((CheckBox)rptItem.FindControl("chk")).Checked)
				{
					ObjOrg.CertificationID.Add(Convert.ToInt32(((HiddenField)rptItem.FindControl("hdnID")).Value));
				}
			}

			ObjOrg.UpdateOrganizationInfo();
		}

		private void SaveData()
		{
			OrganizationInfo ObjOrg = new OrganizationInfo();
			ObjOrg.Abbreviation = "";
			ObjOrg.Address = txtBusinessAddress1.Text;
			//ObjOrg.BillingContact = txtbillingContact.Text;
			ObjOrg.BillMailAddress = txtMailingAddress1.Text;

			ObjOrg.BusinessType = new List<int>();

			ObjOrg.City = "";
			ObjOrg.Clientid = 0;
			ObjOrg.ContactId = 0;
			ObjOrg.CountryID = Convert.ToInt32(ddlBusinessCountry.SelectedValue);
			ObjOrg.CountryName = ddlBusinessCountry.Text;
			ObjOrg.DateCreated = DateTime.Now.Date;
			ObjOrg.DBAName = txtDBAName.Text;
			ObjOrg.Description = "";
			ObjOrg.IsActive = true;

			ObjOrg.IsOrganization = true;
			ObjOrg.Language = "";
			ObjOrg.LanguageId = LanguageId;
			ObjOrg.LegalName = txtBusinessLegalName.Text;
			ObjOrg.LocationID = 0;
			ObjOrg.OrganizationId = 0;
			ObjOrg.OrganizationTypeId = 1;
			ObjOrg.OwnerManager = txtPrimaryContactFirstName.Text;
			ObjOrg.ParentId = 0;
			ObjOrg.PhoneId = 0;
			ObjOrg.RoleId = 0;
			ObjOrg.RoleName = "";
			ObjOrg.Specific = "";
			if (Request.QueryString["StakeHolderID"] != null && Utils.IsNumeric(Request.QueryString["StakeHolderID"]))
			{
				ObjOrg.StakeHolderId = Convert.ToInt32(Request.QueryString["StakeHolderID"]);
			}
			else
			{
				ObjOrg.StakeHolderId = 0;
			}

			ObjOrg.StateID = Convert.ToInt32(ddlBusinessProvince.SelectedValue);
			ObjOrg.Supplierid = 0;
			ObjOrg.TX_ID = "";
			ObjOrg.Website = "";
			ObjOrg.ZipPostalCode = txtBusinessZipCode.Text;

			OrganizationInfo.Supplier ObjOrgSupplier = new OrganizationInfo.Supplier();

			ObjOrgSupplier.BussinessPhone = txtSupplierBusinessPhone1.Text.Trim() + "-" + txtSupplierBusinessPhone2.Text.Trim() + "-" + txtSupplierBusinessPhone3.Text.Trim();
			ObjOrgSupplier.City = txtSupplierCity.Text;
			ObjOrgSupplier.CompanyName = txtSupplierCompanyName.Text;
			ObjOrgSupplier.ContactName = txtSupplierscontactName.Text;
			ObjOrgSupplier.Count = 0;
			ObjOrgSupplier.CountryID = int.Parse(ddlSuppliersCountry.SelectedValue);
			ObjOrgSupplier.DateCreated = DateTime.Now;
			ObjOrgSupplier.Email = txtSuppliersownerEmail.Text;
			ObjOrgSupplier.IsActive = true;
			ObjOrgSupplier.LanguageID = LanguageId;
			ObjOrgSupplier.OwnerManagerEmail = txtSuppliersownerEmail.Text;
			ObjOrgSupplier.StateId = Convert.ToInt32(ddlSuppliersProvince.SelectedValue);
			ObjOrgSupplier.SupplierID = 0;

			ObjOrg.objSupplier = ObjOrgSupplier;

			OrganizationInfo.Client objOrgClient = new OrganizationInfo.Client();

			objOrgClient.BussinessPhone = txtClientBusinessPhone1.Text.Trim() + "-" + txtClientBusinessPhone2.Text.Trim() + "-" + txtClientBusinessPhone3.Text.Trim();
			objOrgClient.City = txtClientCity.Text;
			objOrgClient.ClientID = 0;
			objOrgClient.CompanyName = txtclientsCompanyName.Text;
			objOrgClient.ContactName = txtclientsContactName.Text;
			objOrgClient.CountryID = int.Parse(ddlclientsCountry.SelectedValue);
			objOrgClient.DateCreated = DateTime.Now;
			objOrgClient.IsActive = true;
			objOrgClient.LanguageId = LanguageId;
			objOrgClient.OwnerManagerEmail = txtclientsEmail.Text;
			objOrgClient.StateId = Convert.ToInt32(ddlclientsProvince.SelectedValue);

			ObjOrg.objClient = objOrgClient;

			ObjOrg.ObjOrgBusiness = new List<OrganizationInfo.Organization_Business>();

			//OrganizationInfo.Organization_Business objOrgBusiness;

			//foreach (RepeaterItem rptItem in rptBusiness.Items)
			//{
			//    objOrgBusiness = new OrganizationInfo.Organization_Business();

			//    CheckBox chkY = (CheckBox)rptItem.FindControl("chkY");
			//    CheckBox chkN = (CheckBox)rptItem.FindControl("chkN");

			//    if (chkY.Checked || chkN.Checked)
			//    {
			//        objOrgBusiness.BusinessID = Convert.ToInt32(((HiddenField)rptItem.FindControl("hdnID")).Value);
			//        objOrgBusiness.IsNew = chkY.Checked;

			//        ObjOrg.ObjOrgBusiness.Add(objOrgBusiness);

			//    }
			//}

			ObjOrg.CertificationID = new List<int>();

			foreach (RepeaterItem rptItem in rptStakeCertificates.Items)
			{
				if (((CheckBox)rptItem.FindControl("chk")).Checked)
				{
					ObjOrg.CertificationID.Add(Convert.ToInt32(((HiddenField)rptItem.FindControl("hdnID")).Value));
				}
			}

			foreach (RepeaterItem rptItem in rptTireCertificates.Items)
			{
				if (((CheckBox)rptItem.FindControl("chk")).Checked)
				{
					ObjOrg.CertificationID.Add(Convert.ToInt32(((HiddenField)rptItem.FindControl("hdnID")).Value));
				}
			}

			ObjOrg.InsertOrganizationInfo();
		}

		private void LoadInfo(int OrganizationID)
		{
			OrganizationInfo ObjOrg = new OrganizationInfo(OrganizationID);

			txtBusinessLegalName.Text = ObjOrg.LegalName;
			txtDBAName.Text = ObjOrg.DBAName;
			txtBusinessAddress1.Text = ObjOrg.Address;
			ddlBusinessProvince.SelectedValue = Convert.ToString(ObjOrg.StateID);
			ddlBusinessCountry.SelectedValue = Convert.ToString(ObjOrg.CountryID);
			txtBusinessZipCode.Text = ObjOrg.ZipPostalCode;
			txtMailingAddress1.Text = ObjOrg.BillMailAddress;
			txtPrimaryContactFirstName.Text = ObjOrg.OwnerManager;
			//txtbillingContact.Text = ObjOrg.BillingContact;

			//ddlownertitle.SelectedValue = "";
			//ddlbillingContact1.SelectedValue = "";
			//txtBusinessNumber1.Text = "";
			//txtBusinessNumber2.Text = "";
			//txtBusinessNumber3.Text = "";

			if (ObjOrg.objSupplier != null)
			{
				txtSupplierCompanyName.Text = ObjOrg.objSupplier.CompanyName;
				ddlSuppliersCountry.SelectedValue = Convert.ToString(ObjOrg.objSupplier.CountryID);
				ddlSuppliersProvince.SelectedValue = Convert.ToString(ObjOrg.objSupplier.StateId);
				txtClientCity.Text = ObjOrg.objSupplier.City;
				txtSupplierscontactName.Text = ObjOrg.objSupplier.ContactName;

				txtSupplierBusinessPhone1.Text = ObjOrg.objSupplier.BussinessPhone.Split('-')[0];
				txtSupplierBusinessPhone2.Text = ObjOrg.objSupplier.BussinessPhone.Split('-')[1];
				txtSupplierBusinessPhone3.Text = ObjOrg.objSupplier.BussinessPhone.Split('-')[2];
				txtSuppliersownerEmail.Text = ObjOrg.objSupplier.OwnerManagerEmail;
			}

			if (ObjOrg.objClient != null)
			{
				txtclientsCompanyName.Text = ObjOrg.objClient.CompanyName;
				ddlclientsCountry.SelectedValue = Convert.ToString(ObjOrg.objClient.CountryID);
				ddlclientsProvince.SelectedValue = Convert.ToString(ObjOrg.objClient.StateId);
				txtClientCity.Text = Convert.ToString(ObjOrg.objClient.City);
				txtclientsContactName.Text = ObjOrg.objClient.ContactName;
				txtClientBusinessPhone1.Text = ObjOrg.objClient.BussinessPhone.Split('-')[0];
				txtClientBusinessPhone2.Text = ObjOrg.objClient.BussinessPhone.Split('-')[1];
				txtClientBusinessPhone3.Text = ObjOrg.objClient.BussinessPhone.Split('-')[2];
				txtclientsEmail.Text = ObjOrg.objClient.OwnerManagerEmail;
			}

			chkotsPrivacy.Checked = true;
			chktiretraxPrivacy.Checked = true;

			foreach (int item in ObjOrg.CertificationID)
			{
				foreach (RepeaterItem rptItem in rptStakeCertificates.Items)
				{
					if (item == Convert.ToInt32(((HiddenField)rptItem.FindControl("hdnID")).Value))
					{
						((CheckBox)rptItem.FindControl("chk")).Checked = true;
					}
				}
			}

			foreach (int item in ObjOrg.CertificationID)
			{
				foreach (RepeaterItem rptItem in rptTireCertificates.Items)
				{
					if (item == Convert.ToInt32(((HiddenField)rptItem.FindControl("hdnID")).Value))
					{
						((CheckBox)rptItem.FindControl("chk")).Checked = true;
					}
				}
			}

			//foreach (OrganizationInfo.Organization_Business item in ObjOrg.ObjOrgBusiness)
			//{
			//    foreach (RepeaterItem rptItem in rptBusiness.Items)
			//    {
			//        if (item.BusinessID == Convert.ToInt32(((HiddenField)rptItem.FindControl("hdnID")).Value))
			//        {
			//            if (item.IsNew)
			//                ((CheckBox)rptItem.FindControl("chkY")).Checked = true;
			//            else
			//                ((CheckBox)rptItem.FindControl("chkN")).Checked = true;
			//        }
			//    }
			//}
		}
		*/
    #endregion

    #region AddBasicInfo

    protected void lnkbtnStep1_Click(object sender, EventArgs e)
    {
        try
        {
            string standardstewardshipIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
            string[] arr = standardstewardshipIds.Split(',');
            for (int i = 0; i < arr.Count(); i++)
            {

                if (ddlOrganizationType.SelectedValue == arr[i]) //LookupsManagement.LookupType.OrganizationTypes_Stewardship
                {
                    if (OrganizationInfo.CheckStateAvailableForStewarship(Conversion.ParseInt(ddlBusinessProvince.SelectedValue)) > 0)
                    {
                        lblStewardshipExists.Visible = true;
                        return;
                    }
                }
            }
            int organizationIdWithSimilerEmail = 0;
            organizationIdWithSimilerEmail = OrganizationInfo.getOrganizationIdByEmail(txtPrimaryContactEmail.Text.Trim(), Conversion.ParseInt(ddlBusinessProvince.SelectedValue));
            if (organizationIdWithSimilerEmail > 0)
            {
                lblemailalreadyexists.Text = ResourceMgr.GetError("Email already exists for this state. Choose another");
                lblemailalreadyexists.Visible = true;
                return;
            }
            else
            {
                lblemailalreadyexists.Visible = false;
            }
            OrganizationInfo objOrg = new OrganizationInfo();

            if (Utils.IsNumeric(hdnOrganizationID.Value) == true)
                objOrg.OrganizationId = Convert.ToInt32(hdnOrganizationID.Value);
            else
                objOrg.OrganizationId = -1;

            objOrg.LegalName = txtBusinessLegalName.Text.Trim();
            objOrg.DBAName = txtDBAName.Text.Trim();
            objOrg.OrganizationTypeId = Convert.ToInt32(ddlOrganizationType.SelectedValue);
            ViewState["OrganizationTypeId"] = objOrg.OrganizationTypeId.ToString();
            objOrg.OrganizationSubTypeID = Convert.ToInt32(ddlOrganizationSubType.SelectedValue);
            //string SubIDs = "";
            //foreach (ListItem item in ddlOrganizationSubType.Items)
            //{
            //    if (item.Selected)
            //    {
            //        SubIDs += item.Value + ",";
            //    }
            //}

            //SubIDs = SubIDs.TrimEnd(',');
            ViewState["OrganizationSubTypeId"] = objOrg.OrganizationSubTypeID.ToString();

            objOrg.Website = txtBusinessWebsite.Text.Trim();

            objOrg.AccountingInterfaceId = Convert.ToInt32(ddlBusinessAccountingInterface.SelectedValue);
            objOrg.InventoryInterfaceId = Convert.ToInt32(ddlBusinessInventoryInterface.SelectedValue);
            objOrg.IsAutoFundTransfer = chkBusinessAcceptAutoFundTransfers.Checked;
            objOrg.IsActive = true;
            objOrg.IsOrganization = true;
            objOrg.LanguageId = LanguageId;

            int RoleId = Convert.ToInt32(UserInfo.UserRole.Stakeholder);

            if (Convert.ToInt32(ddlOrganizationType.SelectedValue) == Convert.ToInt32(LookupsManagement.LookupType.OrganizationTypes_Stewardship) ||
                Convert.ToInt32(ddlOrganizationType.SelectedValue) == Convert.ToInt32(LookupsManagement.LookupType.OrganizationTypes_GlobalSteward) ||
                Convert.ToInt32(ddlOrganizationType.SelectedValue) == Convert.ToInt32(LookupsManagement.LookupType.OrganizationTypes_LocalSteward)
                )
            {
                RoleId = Convert.ToInt32(UserInfo.UserRole.Stewardship);
            }

            objOrg.RoleId = RoleId;

            ContactInfo objPrimaryContact = new ContactInfo();

            objPrimaryContact.FirstName = txtPrimaryContactFirstName.Text.Trim();
            objPrimaryContact.LastName = txtPrimaryContactLastName.Text.Trim();
            objPrimaryContact.ContactTitleId = Convert.ToInt32(ddlPrimaryContactTitle.SelectedValue);
            objPrimaryContact.Email = txtPrimaryContactEmail.Text.Trim();
            ViewState["PrimaryEmail"] = txtPrimaryContactEmail.Text.Trim();
            objPrimaryContact.IsActive = true;
            objPrimaryContact.IsPrimary = true;
            objPrimaryContact.LanguageId = LanguageId;
            //objPrimaryContact.ContactTypeId = Convert.ToInt32(ContactInfo.ContactTypes.Business);
            objPrimaryContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Business);

            Phones objPrimaryContactBusinessPhone = new Phones();

            objPrimaryContactBusinessPhone.Number = txtPrimaryContactBusinessPhone1.Text.Trim() + "-" + txtPrimaryContactBusinessPhone2.Text.Trim() + "-" + txtPrimaryContactBusinessPhone3.Text.Trim();
            objPrimaryContactBusinessPhone.Extension = txtPrimaryContactBusinessPhoneExtension.Text.Trim();
            objPrimaryContactBusinessPhone.IsActive = true;
            //objPrimaryContactBusinessPhone.PhoneTypeId = Convert.ToInt32(Phones.PhoneType.Business);
            objPrimaryContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

            Phones objPrimaryContactCellPhone = new Phones();

            objPrimaryContactCellPhone.Number = txtPrimaryContactCellPhone1.Text.Trim() + "-" + txtPrimaryContactCellPhone2.Text.Trim() + "-" + txtPrimaryContactCellPhone3.Text.Trim();
            objPrimaryContactCellPhone.IsAcceptTextMessages = chkPrimaryContactAcceptTextMessages.Checked;
            objPrimaryContactCellPhone.IsActive = true;
            //objPrimaryContactCellPhone.PhoneTypeId = Convert.ToInt32(Phones.PhoneType.Cell);
            objPrimaryContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

            ContactInfo objBillingContact = new ContactInfo();

            objBillingContact.FirstName = txtBillingContactFirstName.Text.Trim();
            objBillingContact.LastName = txtBillingContactLastName.Text.Trim();
            objBillingContact.ContactTitleId = Convert.ToInt32(ddlBillingContactTitle.SelectedValue);
            objBillingContact.Email = txtBillingContactEmail.Text.Trim();
            objBillingContact.IsActive = true;
            objBillingContact.IsPrimary = false;
            objBillingContact.LanguageId = LanguageId;
            //objBillingContact.ContactTypeId = Convert.ToInt32(ContactInfo.ContactTypes.Billing);
            objBillingContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Billing);

            Phones objBillingContactBusinessPhone = new Phones();

            objBillingContactBusinessPhone.Number = txtBillingContactPhoneNumber1.Text.Trim() + "-" + txtBillingContactPhoneNumber2.Text.Trim() + "-" + txtBillingContactPhoneNumber3.Text.Trim();
            objBillingContactBusinessPhone.Extension = txtBillingContactPhoneExtension.Text.Trim();
            objBillingContactBusinessPhone.IsActive = true;
            //objBillingContactBusinessPhone.PhoneTypeId = Convert.ToInt32(Phones.PhoneType.Business);
            objBillingContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

            Phones objBillingContactCellPhone = new Phones();

            objBillingContactCellPhone.Number = txtBillingContactCellNumber1.Text.Trim() + "-" + txtBillingContactCellNumber2.Text.Trim() + "-" + txtBillingContactCellNumber3.Text.Trim();
            objBillingContactCellPhone.IsAcceptTextMessages = chkBillingContactAcceptTextMessages.Checked;
            objBillingContactCellPhone.IsActive = true;
            //objBillingContactCellPhone.PhoneTypeId = Convert.ToInt32(Phones.PhoneType.Cell);
            objBillingContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

            OrganizationInfo.Organization_Address objBusinessOrganization_Address = new OrganizationInfo.Organization_Address();

            objBusinessOrganization_Address.ZipCodeID = Convert.ToInt32(hdnBusinessZipCodeId.Value);
            objBusinessOrganization_Address.ZipPostalCode = txtBusinessZipCode.Text.Trim();
            objBusinessOrganization_Address.Address1 = txtBusinessAddress1.Text.Trim();
            objBusinessOrganization_Address.Address2 = txtBusinessAddress2.Text.Trim();
            objBusinessOrganization_Address.City = txtBuinessCity.Text;
            objBusinessOrganization_Address.CityId = Convert.ToDouble(hfCityId.Value);
            objBusinessOrganization_Address.StateID = Convert.ToInt32(ddlBusinessProvince.SelectedValue);
            objBusinessOrganization_Address.CountryID = Convert.ToInt32(ddlBusinessCountry.SelectedValue);
            objBusinessOrganization_Address.DateCreated = DateTime.Now;
            objBusinessOrganization_Address.IsActive = true;
            //objBusinessOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(OrganizationInfo.Organization_Address.Organization_AddressType.Business);
            objBusinessOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Business);

            OrganizationInfo.Organization_Address objMailingOrganization_Address = new OrganizationInfo.Organization_Address();

            objMailingOrganization_Address.ZipCodeID = Convert.ToInt32(hdnMailingZipCodeId.Value);
            objMailingOrganization_Address.ZipPostalCode = txtMailingZipCode.Text.Trim();
            objMailingOrganization_Address.Address1 = txtMailingAddress1.Text.Trim();
            objMailingOrganization_Address.Address2 = txtMailingAddress2.Text.Trim();
            objMailingOrganization_Address.City = txtMailingCity.Text;
            objMailingOrganization_Address.CityId = Convert.ToDouble(hfmailingCityId.Value);
            objMailingOrganization_Address.StateID = Convert.ToInt32(ddlMailingState.SelectedValue);
            objMailingOrganization_Address.CountryID = Convert.ToInt32(ddlMailingCountry.SelectedValue);
            objMailingOrganization_Address.DateCreated = DateTime.Now;
            objMailingOrganization_Address.IsActive = true;
            //objMailingOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(OrganizationInfo.Organization_Address.Organization_AddressType.Mailing);
            objMailingOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Mailing);

            string catIDs = "";
            foreach (ListItem item in chkProductId.Items)
            {
                if (item.Selected)
                {
                    catIDs += item.Value + ",";
                }
            }

            catIDs = catIDs.TrimEnd(',');

            OrganizationInfo.SavePrimaryInfo(objOrg, objPrimaryContact, objPrimaryContactBusinessPhone, objPrimaryContactCellPhone, objBillingContact, objBillingContactBusinessPhone, objBillingContactCellPhone, objBusinessOrganization_Address, objMailingOrganization_Address, catIDs);


            
            foreach (ListItem item in chkProductId.Items)
            {
                DataSet Check = Product.GetAllSubCategories(Convert.ToInt32(item.Value));
                if (Check != null && Check.Tables[0].Rows.Count > 0 && item.Selected)
                {
                    string SubIds = "";
                    foreach(DataRow row in Check.Tables[0].Rows)
                    {
                        SubIds += row["SubProductId"] + ",";
                    }
                    SubIds = SubIds.TrimEnd(',');
                    Product.InsertProductTypes(Convert.ToInt32(objOrg.OrganizationId), Convert.ToInt32(item.Value), SubIds);
                }
            }

            hdnOrganizationID.Value = Convert.ToString(objOrg.OrganizationId);
            int organizationtypeid = Convert.ToInt32(ddlOrganizationType.SelectedItem.Value);
            // OrganizationInfo.SetStatus(OrganizationStatus.Pending, objOrg.OrganizationId, "Registered", organizationtypeid);
            // Utils.GetLookUpData<DropDownList>(ref ddlRoleList, LookUps.RoleName, Conversion.ParseInt(ddlOrganizationType.SelectedValue));

            if (objOrg.OrganizationId > 0)
            {
                //if (Page.IsValid)
                //{
                //    string keyfor = ddlOrganizationType.SelectedItem.Text.Trim();
                //    string tabName = "";

                //    switch (keyfor)
                //    {
                //        case "Consumer":
                //            tabName = "tab-7";
                //            break;
                //        default:
                //            break;
                //    }

                //    ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "Step2", String.Format("GotoNextStep('{2}');SetHiddenFieldValue('{0}','{1}');", hdnOrganizationID.ClientID, objOrg.OrganizationId,tabName), true);
                //}

            }



            //Utils.GetLookUpData<DropDownList>(ref ddlRoleList, LookUps.RoleTypes, Conversion.ParseInt(ddlOrganizationType.SelectedValue));//Role Types by organizationTypeId

        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "RegistrationForm.lnkbtnStep1_Click", ex);
        }
    }
    protected void lnkbtnUpdate_Click(object sender, EventArgs e)
    {
        // int stateId = OrganizationInfo.getStateId(OrganizationID);
        //int  organizationIdWithSimilerEmail = OrganizationInfo.getOrganizationIdByEmail(txtPrimaryEmail.Text.Trim(), stateId);
        //if (organizationIdWithSimilerEmail > 0)
        //{
        //    lblemailalreadyexists.Text = "Email already exists for this state. Choose another";
        //    lblemailalreadyexists.Visible = true;
        //    return;
        //}
        DataTable dt      = null;
        double    stateId = OrganizationInfo.getStateId(OrganizationID);

        dt = OrganizationInfo.GetCityStateAndCountryByZipCode(txtZipCode.Text.Trim(), GlobalCountryID, stateId);

        if (dt.Rows.Count > 0)
        {
        }
        else
        {
            txtZipCode.Text = "";
            txtZipCode.Focus();
            lblBusinessZipCode.Text = "* Zipcode does not exist in this state.";
            return;
        }
        OrganizationInfo objOrg = new OrganizationInfo(OrganizationID);

        if (dddlcelltextmsgs.SelectedValue == "1")
        {
            objOrg.CellAcceptTextMessages = true;
        }
        else
        {
            objOrg.CellAcceptTextMessages = false;
        }
        if (ddlbusinesstextmsgs.SelectedValue == "1")
        {
            objOrg.AcceptTextMessages = true;
        }
        else
        {
            objOrg.AcceptTextMessages = false;
        }
        objOrg.OrganizationId = OrganizationID;
        //     objOrg.Fax = txtFax.Text.Trim();
        //       objOrg.Address = txtAddress.Text.Trim();
        //  objOrg.BusinessType = txtBusinessType.Text.Trim();
        //       objOrg.BillMailAddress = txtBillingMailAddress.Text.Trim();
        //      objOrg.BillingContact = txtBillingContact.Text.Trim();
        //       objOrg.CellExtension = txtCellPhoneExtension.Text.Trim();
        objOrg.LegalName        = txtBusinessName.Text.Trim();
        objOrg.DBAName          = txtDBAName.Text.Trim();
        objOrg.Website          = txtWebsite.Text.Trim();
        objOrg.IsActive         = true;
        objOrg.IsOrganization   = true;
        objOrg.LanguageId       = LanguageId;
        objOrg.ContactTitleName = txtContactTitle.Text.Trim();
        objOrg.RoleId           = Conversion.ParseInt(UserInfo.UserRole.Stewardship);
        objOrg.UpdateOrganizationInfo();
        ContactInfo objPrimaryContact = new ContactInfo();

        objPrimaryContact.FirstName = txtFirstName.Text.Trim();
        objPrimaryContact.LastName  = txtLastName.Text.Trim();
        objPrimaryContact.Email     = txtPrimaryEmail.Text.Trim();

        objPrimaryContact.IsActive      = true;
        objPrimaryContact.IsPrimary     = true;
        objPrimaryContact.LanguageId    = LanguageId;
        objPrimaryContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Business);

        Phones objPrimaryContactBusinessPhone = new Phones();

        objPrimaryContactBusinessPhone.Number      = txtPhoneNumber.Text.Trim().ToString();
        objPrimaryContactBusinessPhone.Extension   = txtPhoneExtension.Text.Trim().ToString();
        objPrimaryContactBusinessPhone.IsActive    = true;
        objPrimaryContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

        Phones objPrimaryContactCellPhone = new Phones();

        objPrimaryContactCellPhone.Number      = txtCellPhoneNumber.Text.Trim();
        objPrimaryContactCellPhone.IsActive    = true;
        objPrimaryContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

        ContactInfo objBillingContact = new ContactInfo();

        //      objBillingContact.Email = txtBillingMailAddress.Text.Trim();
        objBillingContact.IsActive      = true;
        objBillingContact.IsPrimary     = false;
        objBillingContact.LanguageId    = LanguageId;
        objBillingContact.ContactTypeId = Convert.ToInt32(ContactInfo.ContactTypes.Billing);
        objBillingContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Billing);

        Phones objBillingContactBusinessPhone = new Phones();

        objBillingContactBusinessPhone.IsActive    = true;
        objBillingContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

        Phones objBillingContactCellPhone = new Phones();

        objBillingContactCellPhone.IsActive    = true;
        objBillingContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

        OrganizationInfo.Organization_Address objBusinessOrganization_Address = new OrganizationInfo.Organization_Address();

        objBusinessOrganization_Address.ZipCodeID     = Convert.ToInt32(hdnBusinessZipCodeId.Value);
        objBusinessOrganization_Address.ZipPostalCode = txtZipCode.Text.Trim().ToString();
        objBusinessOrganization_Address.Address1      = txtBusinessAddress1.Text.Trim();
        objBusinessOrganization_Address.Address2      = txtBusinessAddress2.Text.Trim();
        objBusinessOrganization_Address.City          = txtCity.Text.Trim().ToString();
        objBusinessOrganization_Address.StateID       = Convert.ToInt32(ddlState.SelectedValue);
        objBusinessOrganization_Address.CountryID     = Convert.ToInt32(ddlCountry.SelectedValue);
        objBusinessOrganization_Address.DateCreated   = DateTime.Now;
        objBusinessOrganization_Address.IsActive      = true;
        objBusinessOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Business);

        OrganizationInfo.Organization_Address objMailingOrganization_Address = new OrganizationInfo.Organization_Address();
        objMailingOrganization_Address.DateCreated = DateTime.Now;
        objMailingOrganization_Address.IsActive    = true;
        objMailingOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Mailing);

        OrganizationInfo.UpdateStewardshipInfo(objOrg, objPrimaryContact, objPrimaryContactBusinessPhone, objPrimaryContactCellPhone, objBillingContact, objBillingContactBusinessPhone, objBillingContactCellPhone, objBusinessOrganization_Address, objMailingOrganization_Address);
        lblinfo.Visible = true;
        lblinfo.Text    = "Successfully updated";
        viewStakeholdersForApproval();
        pnlDisplay.Visible = true;
        pnlEdit.Visible    = false;
    }
        private Phones GetPhones(int constituentId)
        {
            var phonesData = HttpHelper.Get<PhonesData>(string.Format(serviceBaseUri + "/Phones?ConstituentId={0}", constituentId));

            mapper = new AutoDataContractMapper();
            var phones = new Phones();
            mapper.MapList(phonesData, phones, typeof(Phone));
            return phones;
        }
 public ChargeAdapterForIPhone(Phones.iPhone phone)
 {
     this.phone = phone;
 }