protected void Page_Load(object sender, EventArgs e)
    {
        int status = 0;

        ClientScript.RegisterStartupScript(GetType(), "SetHeaderMenu", "SetHeaderMenu('liStewardship');", true);
        if (!IsPostBack)
        {
            standardstewardshipIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
            OrganizationInfo o = new OrganizationInfo(OrganizationID);
            status = OrganizationInfo.getStewardshipStatusByOrganizationId(OrganizationID, standardstewardshipIds, o.OrganizationTypeId);
            if (status == 1)
                imgBtnPending.Visible = false;
            else if (status == 2)
                imgbtnApprove.Visible = false;
            else if (status == 3)
                imgbtnReject.Visible = false;
            else if (status == 4)
                imgbtnDelete.Visible = false;
            BindDropDowns();
            viewStakeholdersForApproval();
            lblinfo.Visible = false;
            dlg.Visible = false;
        }
        pageId = Request.QueryString.Get("PageId");
        if (pageId == "1")
        {
            pageId = "/Application/PendingApplication.aspx";
        }
        else
        {
            pageId = "/Stewardship/ViewStewardship.aspx";
        }

    }
예제 #2
0
		public static void SaveCertifications(OrganizationInfo ObjOrg)
		{
			try
			{
				using (DbManager DB = DbManager.GetDbManager())
				{
					List<SqlParameter> prm = new List<SqlParameter>();
					prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, ObjOrg.OrganizationId));

					prm.Add(DB.MakeInParam("@CertificationIDs", SqlDbType.NVarChar, -1, string.Join(",", ObjOrg.CertificationID.ToArray())));

					DB.RunProc("Up_Organization_Certification_Insert", prm.ToArray());
				}
			}
			catch (Exception ex)
			{
				new SqlLog().InsertSqlLog(0, "OrganizationInfo.SaveCertifications", ex);
			}
		}
    protected void gvStewardship_RowCommand(object sender, GridViewCommandEventArgs e)
    {

        string url = System.Configuration.ConfigurationManager.AppSettings["EmailUrlStaging"].ToString();
        if (e.CommandName == "DeleteStewardship")
        {
          //  OrganizationInfo.UpdateStewardshipAsInactive(Convert.ToInt32(e.CommandArgument));
         //   OrganizationInfo.SetStatus(OrganizationStatus.Deleted, Convert.ToInt32(e.CommandArgument), "Deleted from stewardship");
            LoadGrid();
        }
        else if (e.CommandName == "Approve")
        {
            
            OrganizationInfo.PendingStewardshipChange(Convert.ToInt32(e.CommandArgument));
           
            OrganizationInfo orginfoObj=new OrganizationInfo(Conversion.ParseInt(e.CommandArgument));
            string body = @"<div style='font-size:11px; font-family:Verdana,Arial,Helvetica,sans-serif;'>
                       <p>Dear Concern,</p><p> Your request have been approved click on following URL to continue your application.</p> <br />
                       <a target='_blank' href="+url+">Click</a></div>";
            Email mail = new Email("*****@*****.**", orginfoObj.PrimaryEmail, "Registration Approval Email For Organization " + orginfoObj.LegalName + " .", body);
           
        
                LoadGrid();
        }
    }
    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);
        }
    }
    /*

		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 lnkBtnStep2_Click(object sender, EventArgs e)
    {

        //ddlRoleList.Items.Clear();
        //Utils.GetLookUpData<DropDownList>(ref ddlRoleList, LookUps.RoleName, Conversion.ParseInt(ddlOrganizationType.SelectedValue));

        if (Utils.IsNumeric(hdnOrganizationID.Value) == false)
            return;
        OrganizationInfo ObjOrg = new OrganizationInfo();
        ObjOrg.OrganizationId = Convert.ToInt32(hdnOrganizationID.Value);
        ObjOrg.CertificationID = new List<int>();

        bool IsCertifiedInspector = false;
        foreach (RepeaterItem rptItem in rptStakeCertificates.Items)
        {
            if (((CheckBox)rptItem.FindControl("chk")).Checked)
            {
                HiddenField hid = (HiddenField)rptItem.FindControl("hdnID");
                if (hid.Value == "16")
                    IsCertifiedInspector = true;
                ObjOrg.CertificationID.Add(Convert.ToInt32(hid.Value));
            }
        }

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

        OrganizationInfo.SaveCertifications(ObjOrg);

        /////////////////////////////////////Commented for testing //////////////////////////////////////////////

        if (IsCertifiedInspector)
            ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "Step3", "DisableInspectorTab();", true);
        else
        {
            ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "Step3", "EnableInspectorTab();", true);
            //    //ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "Step3", "GotoNextStep();", true);
        }

        //////////////////////// End of Commented for testing here /////////////////////////////////////////////////
    }
예제 #7
0
    protected void lnkbtnAddInventory_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["SelectedLotId"] == "")
            {
                lblLotError.Text = "Please Select Any Lot!.";
                return;
            }
            else
                lblLotError.Text = string.Empty;

            StringBuilder str = new StringBuilder(255);
            if ((int)ProductCategory.Tire == CatId)
            {
                str.Append(Conversion.ParseString(Session["SelectedTiresId"]));
            }
            else
            {
                str.Append(Conversion.ParseString(Session["SelectedProductId"]));
            }

            if (str.ToString()[0] == ',')
            {
                str = str.Remove(0, 1);
            }


            //yahan sy 
            string[] arr = str.ToString().Split(',');
            arr = arr.Distinct().ToArray();
            List<string> LotIds = new List<string>();
            foreach (string st in arr)
            {
                string[] arrLot = st.Split(',');
                if (!LotIds.Contains(arrLot[0]))
                {
                    LotIds.Add(arrLot[0]);
                }
            }
            //StringBuilder tireIds = new StringBuilder(255);
            //List<string> TireIds = new List<string>();
            // string[] LotTires = new string[2];

            foreach (string lotid in LotIds)
            {
                int count = 0;
                tireids = "";
                foreach (string id in arr)
                {
                    string[] bothids = id.Split(',');
                    if (bothids[0] == lotid)
                    {
                        if (count == 0)
                        {

                            tireids += bothids[count];
                        }
                        else
                        {
                            tireids += "," + bothids[count];
                        }
                        count++;
                    }
                }

                //yaha tak
                string testtireids = tireids;
                if (string.IsNullOrEmpty(tireids.ToString()))
                {
                    if (CatId == (int)ProductCategory.Tire)
                    {
                        lblTireError.Text = "Please Select Any Tire!.";
                    }
                    else
                    {
                        lblProductError.Text = "Please Select Any Product!.";
                    }

                    return;
                }
                else
                {
                    lblTireError.Text = string.Empty;
                    DataSet ds = null;
                    string ExistingPteTireIds = null;
                    int stateid = OrganizationInfo.getStateId(UserOrganizationId);
                    int organizaionsubtypeid = new OrganizationInfo(UserOrganizationId).OrganizationSubTypeID;
                    string SelectedTiresIds = string.Join(",", arr);
                    if (CatId == (int)ProductCategory.Tire)
                    {
                        ds = Loads.GetPteByTireId(stateid, organizaionsubtypeid, SelectedTiresIds);
                    }
                    else
                    {
                        ds = Loads.GetPteByProductId(stateid, organizaionsubtypeid, SelectedTiresIds, CatId);
                    }


                    foreach (DataRow row in ds.Tables[0].Rows)
                        ExistingPteTireIds += row["ProductId"].ToString() + ",";
                    if (ExistingPteTireIds != null)
                        ExistingPteTireIds = ExistingPteTireIds.Remove(ExistingPteTireIds.Length - 1);
                    //string ExistingPteTireIdsString = string.Join(",", TireIdsForExistingPTE.Select(n => n.ToString()).ToArray());
                    string ExistingPteTireIdsString = string.Join(",", ExistingPteTireIds);
                    string[] NONExistingPteTireIds = SelectedTiresIds.Split(new char[] { ',' }).Except(ExistingPteTireIdsString.Split(new char[] { ',' })).ToArray();
                    NONExistingPteTireIdsString = string.Join(",", NONExistingPteTireIds);
                }

                string tired = Conversion.ParseString(Session["SelectedTiresId"]);
                Loads.AddLoadTires(Convert.ToInt32(Session["loadId"]), tireids, LoginMemberId);
            }
            Loads loadobj = new Loads(Convert.ToInt32(Session["loadId"]));
            if (loadobj.LoadTypeId == 75)
            {
                SendNotification(Convert.ToInt32(Session["loadId"]));
            }

            Response.Redirect("inventory-load", true);

            //if (NONExistingPteTireIdsString != null && NONExistingPteTireIdsString.Length > 0)
            //{

            //    //DataSet dset = null;
            //    //if (CatId == (int)ProductCategory.Tire)
            //    //{
            //    //    dvPteNotDefined.Visible = true;
            //    //    dset = Tire.getSizecodeForTireIds(NONExistingPteTireIdsString);
            //    //    gvSizeCodes.DataSource = dset;
            //    //    gvSizeCodes.DataBind();
            //    //}
            //    //else
            //    //{
            //    //    dvPteNotDefinedProduct.Visible = true;
            //    //    dset = Product.getSizecodeForProductIds(NONExistingPteTireIdsString);
            //    //    gvSizeCodesProduct.DataSource = dset;
            //    //    gvSizeCodesProduct.DataBind();

            //    //    Response.Redirect("inventory-load", true);
            //    //}


            //}
            //else
                

        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "createload.lnkbtnAddInventory_Click", ex);
        }
    }
예제 #8
0
 private void LoadHaulerGrid()
 {
     try
     {
         string standardstewardshipIds = "";
         standardstewardshipIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
         OrganizationInfo objorg = new OrganizationInfo(UserOrganizationId);
         string[] arr = standardstewardshipIds.Split(',');
         bool isstewardship = false;
         foreach (var id in arr)
         {
             if (Conversion.ParseInt(id) == objorg.OrganizationTypeId)
                 isstewardship = true;
         }
         //  UserInfo userobj = new UserInfo(LoginMemberId);
         if (isstewardship)
         {
             DataSet ds = Lots.GetAllHaulerbyOrganizationId(UserOrganizationId);
             grvOrganizations.DataSource = ds;
             grvOrganizations.DataBind();
         }
         else
         {
             DataSet ds = Lots.GetOrganizationsbyStewardship(UserOrganizationId, CatId);
             grvOrganizations.DataSource = ds;
             grvOrganizations.DataBind();
             if (!(ds != null && ds.Tables[0].Rows.Count > 0))
             {
                 lnkPermanentLot.Visible = false;                    
             }
         }
         dvOrganization.Visible = true;
         //if (grvOrganizations.Rows.Count == 0)
         //{
             
         //}
     }
     catch (Exception ex)
     {
         new SqlLog().InsertSqlLog(0, "lotInfo .LoadPermanentGrid", ex);
     }
 }
    protected void lnkbtnApprove_Click(object sender, EventArgs e)
    { lblinfo.Visible = false;
        standardstewardshipIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
        OrganizationInfo o = new OrganizationInfo(OrganizationID);
        OrganizationInfo.SetStatus(OrganizationStatus.Accepted, OrganizationID, txtNotes.Text, o.OrganizationTypeId, standardstewardshipIds);
     DataSet ds =   UserInfo.getDefaultUsers(OrganizationID);
     if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count>0)
     {

         UserInfo user = new UserInfo(Convert.ToInt32(ds.Tables[0].Rows[0]["UserId"].ToString()));
         if (!user.IsApproved)
         {
             Emails email = new Emails();
             email.To = user.Login;
             email.URL = ConfigurationManager.AppSettings["EmailUrl"].ToString() + "ChangePassword.aspx?userId=" + Encryption.Encrypt(user.UserId.ToString());
             email.From = "*****@*****.**";
             email.Subject = "Registration Approval Email";
             Thread Email_Thread = new Thread(() => SendEmails(email, Emails.EmailType.ApplicationApprovedEmail.ToString()));
             Email_Thread.Start();
         }
     }
        Response.Redirect(pageId);
        lblinfo.Text = "Successfully Approved";
        lblinfo.Visible = true;

    }
    protected void viewStakeholdersForApproval()
    {
       // txtZipCode.Enabled = false;
        txtCity.Enabled = false;
        ddlCountry.Enabled = false;
        OrganizationStatus s;
        standardstewardshipIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
        OrganizationInfo o = new OrganizationInfo(OrganizationID);
        s = (OrganizationStatus)(OrganizationInfo.getStewardshipStatusByOrganizationId(OrganizationID, standardstewardshipIds, o.OrganizationTypeId));
        lblStatus.Text = s.ToString();
        lblStatusNotes.Text = (OrganizationInfo.getLatestNotesStatusByOrganizationId(OrganizationID));
        lblStatus.Text = s.ToString();
        OrganizationInfo organizationInfo = new OrganizationInfo(OrganizationID, true);
        ltrBusinessName.Text = organizationInfo.LegalName;
        txtBusinessName.Text = organizationInfo.LegalName;
        ltrDBAName.Text = organizationInfo.DBAName;
        txtDBAName.Text = organizationInfo.DBAName;
        ltrFirstName.Text = organizationInfo.FirstName;
        txtFirstName.Text = organizationInfo.FirstName;
        ltrLastName.Text = organizationInfo.LastName;
        txtLastName.Text = organizationInfo.LastName;
        ltrprimaryEmail.Text = organizationInfo.Email;
        txtPrimaryEmail.Text = organizationInfo.Email;
        ltrPhoneNumber.Text = organizationInfo.BusinessNumber;
        txtPhoneNumber.Text = organizationInfo.BusinessNumber;
        ltrPhoneExtension.Text = organizationInfo.BusinessExtension;
        txtPhoneExtension.Text = organizationInfo.BusinessExtension;
        ltrCellPhoneNumber.Text = organizationInfo.CellNumber;
        txtCellPhoneNumber.Text = organizationInfo.CellNumber;
      //  ltrCellPhoneExtension.Text = organizationInfo.CellExtension;
    //    txtCellPhoneExtension.Text = organizationInfo.CellExtension;
        ltrZipCode.Text = organizationInfo.ZipCode;
        txtZipCode.Text = organizationInfo.ZipCode;
        hdnBusinessZipCodeId.Value = Conversion.ParseString(organizationInfo.ZipCodeID);
        ltrState.Text = organizationInfo.StateName;       
        ltrCountry.Text = organizationInfo.CountryName;
        ddlCountry.SelectedValue = Conversion.ParseString(organizationInfo.CountryID);
        ddlState.SelectedValue = Conversion.ParseString(organizationInfo.StateID);
        
        ltrCity.Text = organizationInfo.City;
        txtCity.Text = organizationInfo.City;
        ltrOrganization.Text = organizationInfo.Description;
        txtOrganization.Text = organizationInfo.Description;
        ltrContactTitle.Text = organizationInfo.ContactTitleName;
        txtContactTitle.Text = organizationInfo.ContactTitleName;

    //    ltrBusinessType.Text = organizationInfo.BusinesType;
    //    txtBusinessType.Text = organizationInfo.BusinesType;
        ltrwebsite.Text = organizationInfo.Website;
        txtWebsite.Text = organizationInfo.Website;
        ltrBusinessAddress1.Text = organizationInfo.BusinessAddress;
        txtBusinessAddress1.Text = organizationInfo.BusinessAddress;
        ltrBusinessAddress2.Text = organizationInfo.AlternativeAddress;
        txtBusinessAddress2.Text = organizationInfo.AlternativeAddress;
        ltrBusinessPhoneType.Text = organizationInfo.BusinessPhoneType;
        txtBusinessPhoneType.Text = organizationInfo.BusinessPhoneType;
        lrtBusinessTextMessage.Text = (organizationInfo.AcceptTextMessages) ? "Yes" : "No";
        if (organizationInfo.AcceptTextMessages) ddlbusinesstextmsgs.SelectedValue = "1"; else ddlbusinesstextmsgs.SelectedValue = "2";


    //    ltrAddress.Text = organizationInfo.Address;
   //     txtAddress.Text = organizationInfo.Address;
    //    ltrBillingContact.Text = organizationInfo.BillingContact;
   //     txtBillingContact.Text = organizationInfo.BillingContact;
//ltrFax.Text = organizationInfo.Fax;
   //     txtFax.Text = organizationInfo.Fax;
        ltrCountryAbbreviation.Text = organizationInfo.Abbreviation;
        txtCountryAbbreviation.Text = organizationInfo.Abbreviation;
        ltrCellTextMessage.Text = (organizationInfo.CellAcceptTextMessages) ?"Yes" :  "No";
        if(organizationInfo.CellAcceptTextMessages)  dddlcelltextmsgs.SelectedValue= "1"; else dddlcelltextmsgs.SelectedValue= "2";
        ltrCellPhoneType.Text = organizationInfo.CellPhoneType;
        txtCellPhoneType.Text = organizationInfo.CellPhoneType;
 //       ltrBillingMailAddress.Text = organizationInfo.BillMailAddress;
  //      txtBillingMailAddress.Text = organizationInfo.BillMailAddress;

    }
    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;

    }
    protected void btndelYes_Click(object sender, EventArgs e)
    {
        OrganizationInfo o = new OrganizationInfo(OrganizationID);

        OrganizationInfo.SetStatus(OrganizationStatus.Deleted, OrganizationID, txtNotes.Text, o.OrganizationTypeId,standardstewardshipIds);
        Response.Redirect(pageId);
        lblinfo.Text = "Successfully deleted";
        lblinfo.Visible = true;
        dlgcnfdel.Visible = false;
    }
    protected void lnkbtnDelete_Click(object sender, EventArgs e)
    {
        DataSet ds;
        OrganizationInfo oi = new OrganizationInfo(OrganizationID);
        string standardstewardshipIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
        string[] standanrdIds = standardstewardshipIds.Split(',');
        foreach (string st in standanrdIds)
        {

            ds = OrganizationInfo.SearchStakeholdersByStewardShip(1, 100, out totalRows, OrganizationID, Conversion.ParseInt(st), true, "", "", "", "", DateTime.MinValue, DateTime.MinValue, LanguageId);
            if (ds.Tables[0].Rows.Count > 0)
            {
                gvApplicationApproved.DataSource = ds;
                gvApplicationApproved.DataBind();
               
                dlg.Visible = true;
                return;
            }

            else
                if (!string.IsNullOrEmpty(txtNotes.Text))
                {
                    dlgcnfdel.Visible = true;
                    

                }
                else
                {
                    string script = string.Format("alert('{0}');", "Cannot delete please provide notes for deleting.");
                    if (Page != null && !Page.ClientScript.IsClientScriptBlockRegistered("function"))
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "function", script, true /* addScriptTags */);
                    }
                }
        }

    }
    protected void lnkbtnPending_Click(object sender, EventArgs e)
    {

        OrganizationInfo o = new OrganizationInfo(OrganizationID);
        standardstewardshipIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
        OrganizationInfo.SetStatus(OrganizationStatus.Pending, OrganizationID, txtNotes.Text, o.OrganizationTypeId, standardstewardshipIds);
        Response.Redirect(pageId);
        lblinfo.Text = "Successfully deleted";
        lblinfo.Visible = true;

    }
예제 #15
0
		public static void SaveAdditionalLocationInfo(OrganizationInfo objOrg, ContactInfo objPrimaryContact, Phones objPrimaryContactBusinessPhone, Phones objPrimaryContactCellPhone, OrganizationInfo.Organization_Address objBusinessOrganization_Address)
		{
			try
			{
				using (DbManager DB = DbManager.GetDbManager())
				{
					List<SqlParameter> prm = new List<SqlParameter>();

					#region Organization Info

					prm.Add(DB.MakeInParam("@LegalName", SqlDbType.NVarChar, 255, objOrg.LegalName));
					prm.Add(DB.MakeInParam("@DBAName", SqlDbType.NVarChar, 255, objOrg.DBAName));
					prm.Add(DB.MakeInParam("@IsLocationEventPermanent", SqlDbType.Bit, 1, objOrg.IsLocationEventPermanent));

					if (objOrg.IsLocationEventPermanent == false)
					{
						prm.Add(DB.MakeInParam("@LocationEventStartDate", SqlDbType.DateTime, 8, objOrg.LocationEventStartDate));
						prm.Add(DB.MakeInParam("@LocationEventEndDate", SqlDbType.DateTime, 8, objOrg.LocationEventEndDate));
						prm.Add(DB.MakeInParam("@LocationEventTypeId", SqlDbType.Int, 4, objOrg.LocationEventTypeId));
					}
					else
					{
						prm.Add(DB.MakeInParam("@LocationEventStartDate", SqlDbType.DateTime, 8, DBNull.Value));
						prm.Add(DB.MakeInParam("@LocationEventEndDate", SqlDbType.DateTime, 8, DBNull.Value));
						prm.Add(DB.MakeInParam("@LocationEventTypeId", SqlDbType.Int, 4, DBNull.Value));
					}

					prm.Add(DB.MakeInParam("@LocationPermitNumber", SqlDbType.NVarChar, 255, objOrg.LocationPermitNumber));
					prm.Add(DB.MakeInParam("@OrgIsActive", SqlDbType.Bit, 1, objOrg.IsActive));
					prm.Add(DB.MakeInParam("@OrgLanguageId", SqlDbType.Int, 4, objOrg.LanguageId));
					prm.Add(DB.MakeInParam("@ParentId", SqlDbType.Int, 4, objOrg.ParentId));

					#endregion

					#region Primary Contact Info

					prm.Add(DB.MakeInParam("@PrimaryContactTypeId", SqlDbType.Int, 4, objPrimaryContact.ContactTypeId));
					prm.Add(DB.MakeInParam("@PrimaryContactFirstName", SqlDbType.NVarChar, 255, objPrimaryContact.FirstName));
					prm.Add(DB.MakeInParam("@PrimaryContactLastName", SqlDbType.NVarChar, 255, objPrimaryContact.LastName));
					prm.Add(DB.MakeInParam("@PrimaryContactTitleId", SqlDbType.Int, 4, objPrimaryContact.ContactTitleId));
					prm.Add(DB.MakeInParam("@PrimaryContactEmail", SqlDbType.NVarChar, 200, objPrimaryContact.Email));
					prm.Add(DB.MakeInParam("@PrimaryContactIsActive", SqlDbType.Bit, 1, objPrimaryContact.IsActive));
					prm.Add(DB.MakeInParam("@PrimaryContactIsPrimary", SqlDbType.Bit, 1, objPrimaryContact.IsPrimary));
					prm.Add(DB.MakeInParam("@PrimaryContactLanguageId", SqlDbType.Int, 4, objPrimaryContact.LanguageId));

					#endregion

					#region Primary Contact Business Phone Info

					prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactBusinessPhone.Number));
					prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneExtension", SqlDbType.NVarChar, 7, objPrimaryContactBusinessPhone.Extension));
					prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactBusinessPhone.PhoneTypeId));
					prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactBusinessPhone.IsActive));

					#endregion

					#region Primary Contact Cell Phone Info

					prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactCellPhone.Number));
					prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsAcceptTextMessages", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsAcceptTextMessages));
					prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactCellPhone.PhoneTypeId));
					prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsActive));

					#endregion

					#region Business Organization Address Info

					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCodeId", SqlDbType.Int, 4, objBusinessOrganization_Address.ZipCodeID));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCode", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.ZipPostalCode));
					prm.Add(DB.MakeInParam("@BusinessOrganizationAddress1", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address1));
					prm.Add(DB.MakeInParam("@BusinessOrganizationAddress2", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address2));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCity", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.City));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressStateId", SqlDbType.Int, 4, objBusinessOrganization_Address.StateID));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCountryID", SqlDbType.Int, 4, objBusinessOrganization_Address.CountryID));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressIsActive", SqlDbType.Bit, 1, objBusinessOrganization_Address.IsActive));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressDateCreated", SqlDbType.DateTime, 8, objBusinessOrganization_Address.DateCreated));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressTypeId", SqlDbType.Int, 4, objBusinessOrganization_Address.Organization_AddressTypeId));

					#endregion

					objOrg.OrganizationId = DB.RunProc("up_OrganizationAdditionalLocationAdd", prm.ToArray());
				}
			}
			catch (Exception ex)
			{
				new SqlLog().InsertSqlLog(0, "OrganizationInfo.SaveAdditionalLocationInfo", ex);
			}
		}
    protected void lnkbtnPending_Click(object sender, EventArgs e)
    {
        try{
        OrganizationInfo o = new OrganizationInfo(OrganizationID);
        standardstewardshipIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
        OrganizationInfo.SetStatus(OrganizationStatus.Pending, OrganizationID, txtNotes.Text, o.OrganizationTypeId, standardstewardshipIds);
        Response.Redirect(pageId);
        lblinfo.Text = "Successfully deleted";
        lblinfo.Visible = true;
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(currentUserInfo.UserId, "viewStakeHolder.lnkbtnPending_click", ex);
        }

    }
예제 #17
0
        public static void UpdateStewardshipInfo(OrganizationInfo objOrg, ContactInfo objPrimaryContact, Phones objPrimaryContactBusinessPhone, Phones objPrimaryContactCellPhone, ContactInfo objBillingContact, Phones objBillingContactBusinessPhone, Phones objBillingContactCellPhone, Organization_Address objBusinessOrganization_Address, Organization_Address objMailingOrganization_Address)
        {
            try
            {
                using (DbManager DB = DbManager.GetDbManager())
                {
                    List<SqlParameter> prm = new List<SqlParameter>();

                    #region Organization Info

                    if (objOrg.OrganizationId > 0)
                        prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, objOrg.OrganizationId));
                    else
                        prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, DBNull.Value));
                    prm.Add(DB.MakeInParam("@LegalName", SqlDbType.NVarChar, 255, objOrg.LegalName));
                    prm.Add(DB.MakeInParam("@DBAName", SqlDbType.NVarChar, 255, objOrg.DBAName));
                  //  prm.Add(DB.MakeInParam("@OrganizationTypeId", SqlDbType.Int, 4, objOrg.OrganizationTypeId));
                    prm.Add(DB.MakeInParam("@Website", SqlDbType.NVarChar, 255, objOrg.Website));
                  
                   
                    prm.Add(DB.MakeInParam("@OrgIsActive", SqlDbType.Bit, 1, objOrg.IsActive));
                    //prm.Add(DB.MakeInParam("@AcceptTextMessage", SqlDbType.Bit, 1, objOrg.AcceptTextMessages));
                    //prm.Add(DB.MakeInParam("@CellAcceptTextMessages", SqlDbType.Bit, 1, objOrg.CellAcceptTextMessages));
                    prm.Add(DB.MakeInParam("@OrgLanguageId", SqlDbType.Int, 4, objOrg.LanguageId));
                   // prm.Add(DB.MakeInParam("@RoleId", SqlDbType.Int, 4, objOrg.RoleId));

                    #endregion

                    #region Primary Contact Info

                   // prm.Add(DB.MakeInParam("@PrimaryContactTypeId", SqlDbType.Int, 4, objPrimaryContact.ContactTypeId));
                    prm.Add(DB.MakeInParam("@PrimaryContactFirstName", SqlDbType.NVarChar, 255, objPrimaryContact.FirstName));
                    prm.Add(DB.MakeInParam("@PrimaryContactLastName", SqlDbType.NVarChar, 255, objPrimaryContact.LastName));
                  //  prm.Add(DB.MakeInParam("@PrimaryContactTitleId", SqlDbType.Int, 4, objPrimaryContact.ContactTitleId));
                    prm.Add(DB.MakeInParam("@PrimaryContactEmail", SqlDbType.NVarChar, 200, objPrimaryContact.Email));
                    prm.Add(DB.MakeInParam("@PrimaryContactIsActive", SqlDbType.Bit, 1, objPrimaryContact.IsActive));
                    prm.Add(DB.MakeInParam("@PrimaryContactIsPrimary", SqlDbType.Bit, 1, objPrimaryContact.IsPrimary));
                   // prm.Add(DB.MakeInParam("@PrimaryContactLanguageId", SqlDbType.Int, 4, objPrimaryContact.LanguageId));

                    #endregion

                    #region Primary Contact Business Phone Info

                    prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactBusinessPhone.Number));
                    prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneExtension", SqlDbType.NVarChar, 7, objPrimaryContactBusinessPhone.Extension));
                  //  prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactBusinessPhone.PhoneTypeId));
                    prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactBusinessPhone.IsActive));

                    #endregion

                    //#region Primary Contact Cell Phone Info

                    //prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactCellPhone.Number));
                    //prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsAcceptTextMessages", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsAcceptTextMessages));
                    //prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactCellPhone.PhoneTypeId));
                    //prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsActive));

                    //#endregion

                    //#region Billing Contact Info

                    //prm.Add(DB.MakeInParam("@BillingContactTypeId", SqlDbType.Int, 4, objBillingContact.ContactTypeId));
                    //prm.Add(DB.MakeInParam("@BillingContactFirstName", SqlDbType.NVarChar, 255, objBillingContact.FirstName));
                    //prm.Add(DB.MakeInParam("@BillingContactLastName", SqlDbType.NVarChar, 255, objBillingContact.LastName));
                    //prm.Add(DB.MakeInParam("@BillingContactTitleId", SqlDbType.Int, 4, objBillingContact.ContactTitleId));
                    //prm.Add(DB.MakeInParam("@BillingContactEmail", SqlDbType.NVarChar, 200, objBillingContact.Email));
                    //prm.Add(DB.MakeInParam("@BillingContactIsActive", SqlDbType.Bit, 1, objBillingContact.IsActive));
                    //prm.Add(DB.MakeInParam("@BillingContactIsPrimary", SqlDbType.Bit, 1, objBillingContact.IsPrimary));
                    //prm.Add(DB.MakeInParam("@BillingContactLanguageId", SqlDbType.Int, 4, objBillingContact.LanguageId));

                    //#endregion

                    //#region Billing Contact Business Phone Info

                    //prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneNumber", SqlDbType.NVarChar, 15, objBillingContactBusinessPhone.Number));
                    //prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneExtension", SqlDbType.NVarChar, 7, objBillingContactBusinessPhone.Extension));
                    //prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneTypeId", SqlDbType.Int, 4, objBillingContactBusinessPhone.PhoneTypeId));
                    //prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneIsActive", SqlDbType.Bit, 1, objBillingContactBusinessPhone.IsActive));

                    //#endregion

                    //#region Billing Contact Cell Phone Info

                    //prm.Add(DB.MakeInParam("@BillingContactCellPhoneNumber", SqlDbType.NVarChar, 15, objBillingContactCellPhone.Number));
                    //prm.Add(DB.MakeInParam("@BillingContactCellPhoneIsAcceptTextMessages", SqlDbType.Bit, 1, objBillingContactCellPhone.IsAcceptTextMessages));
                    //prm.Add(DB.MakeInParam("@BillingContactCellPhoneTypeId", SqlDbType.Int, 4, objBillingContactCellPhone.PhoneTypeId));
                    //prm.Add(DB.MakeInParam("@BillingContactCellPhoneIsActive", SqlDbType.Bit, 1, objBillingContactCellPhone.IsActive));

                    //#endregion

                    #region Business Organization Address Info

                    prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCodeId", SqlDbType.Int, 4, objBusinessOrganization_Address.ZipCodeID));
                    prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCode", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.ZipPostalCode));
                    prm.Add(DB.MakeInParam("@BusinessOrganizationAddress1", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address1));
                    prm.Add(DB.MakeInParam("@BusinessOrganizationAddress2", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address2));
                    prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCity", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.City));
                    prm.Add(DB.MakeInParam("@BusinessOrganization_AddressStateId", SqlDbType.Int, 4, objBusinessOrganization_Address.StateID));
                    prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCountryID", SqlDbType.Int, 4, objBusinessOrganization_Address.CountryID));
                    prm.Add(DB.MakeInParam("@BusinessOrganization_AddressIsActive", SqlDbType.Bit, 1, objBusinessOrganization_Address.IsActive));
                    prm.Add(DB.MakeInParam("@BusinessOrganization_AddressDateCreated", SqlDbType.DateTime, 8, objBusinessOrganization_Address.DateCreated));
                    prm.Add(DB.MakeInParam("@BusinessOrganization_AddressTypeId", SqlDbType.Int, 4, objBusinessOrganization_Address.Organization_AddressTypeId));

                    #endregion

                    //#region Mailing Organization Address Info

                    //prm.Add(DB.MakeInParam("@MailingOrganization_AddressZipCodeId", SqlDbType.Int, 4, objMailingOrganization_Address.ZipCodeID));
                    //prm.Add(DB.MakeInParam("@MailingOrganization_AddressZipCode", SqlDbType.NVarChar, 100, objMailingOrganization_Address.ZipPostalCode));
                    //prm.Add(DB.MakeInParam("@MailingOrganizationAddress1", SqlDbType.NVarChar, 250, objMailingOrganization_Address.Address1));
                    //prm.Add(DB.MakeInParam("@MailingOrganizationAddress2", SqlDbType.NVarChar, 250, objMailingOrganization_Address.Address2));
                    //prm.Add(DB.MakeInParam("@MailingOrganization_AddressCity", SqlDbType.NVarChar, 100, objMailingOrganization_Address.City));
                    //prm.Add(DB.MakeInParam("@MailingOrganization_AddressStateId", SqlDbType.Int, 4, objMailingOrganization_Address.StateID));
                    //prm.Add(DB.MakeInParam("@MailingOrganization_AddressCountryID", SqlDbType.Int, 4, objMailingOrganization_Address.CountryID));
                    //prm.Add(DB.MakeInParam("@MailingOrganization_AddressIsActive", SqlDbType.Bit, 1, objMailingOrganization_Address.IsActive));
                    //prm.Add(DB.MakeInParam("@MailingOrganization_AddressDateCreated", SqlDbType.DateTime, 8, objMailingOrganization_Address.DateCreated));
                    //prm.Add(DB.MakeInParam("@MailingOrganization_AddressTypeId", SqlDbType.Int, 4, objMailingOrganization_Address.Organization_AddressTypeId));

                    //#endregion

                    objOrg.OrganizationId = DB.RunProc("up_updateStewardshipByOrgId", prm.ToArray());
                }
            }
            catch (Exception ex)
            {
                new SqlLog().InsertSqlLog(0, "OrganizationInfo.UpdateStewardshipInfo", ex);
            }
        }
    protected void lnkbtnDelete_Click(object sender, EventArgs e)
    {
        try
        {
            if (!string.IsNullOrEmpty(txtNotes.Text))
            {
                OrganizationInfo o = new OrganizationInfo(OrganizationID);
                standardstewardshipIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
                OrganizationInfo.SetStatus(OrganizationStatus.Deleted, OrganizationID, txtNotes.Text, o.OrganizationTypeId, standardstewardshipIds);
                Response.Redirect(pageId);
                lblinfo.Text = "Successfully deleted";
                lblinfo.Visible = true;
            }
            else
            {
                string script = string.Format("alert('{0}');", "Cannot delete please provide notes for deleting.");
                if (Page != null && !Page.ClientScript.IsClientScriptBlockRegistered("alert"))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "alert", script, true /* addScriptTags */);
                }
            }
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(currentUserInfo.UserId, "viewStakeHolder.lnkbtnDelete_Click", ex);
        }

    }
예제 #19
0
    protected void Page_Load(object sender, EventArgs e)
    {

        //try
        //{
        //    GridView grd = (GridView)gvAdminInventory;
        //    var list = (List<CheckBox>)Session["test"];

        //    CheckBox chkPrv;
        //    int i = 0;
        //    foreach (GridViewRow row in grd.Rows)
        //    {

        //        chkPrv = (CheckBox)row.FindControl("chkLotSelect");
        //        chkPrv.Checked = list[i].Checked;
        //        i++;
        //    }
        //}
        //catch (Exception exe) { }

        string test = hdnLotBarCodeImageFileName.Value + HiddenField5.Value + hidOrgID.Value + hidText.Value + HiddenField1.Value;
        if (!IsPostBack)
        {



            ClientScript.RegisterStartupScript(GetType(), "SetHeaderMenu", String.Format("SetHeaderMenu('liInventory','{0}');", ResourceMgr.GetMessage("Inventory")), true);
            pageSize = 5;
            Utils.GetLookUpData<DropDownList>(ref ddlLoadType, LookUps.LoadType);
            ddlLoadType.SelectedIndex = 1;
            OrganizationInfo orgInfo = new OrganizationInfo(UserInfo.GetCurrentUserInfo().OrganizationId);
            txtCompanyName.Text = orgInfo.LegalName;
            lnkMultiple_Click(null, null);
            //Session["SelectedLotId"] = "";
            Session["Load"] = "";
            Session["loadId"] = "";

            if (Request.QueryString["loadId"] != null && Request.QueryString["ship"] != null)
            {

                SetShipLoadInfo();
            }
            else
            {
                Session["SelectedLotId"] = "";
                Session["SelectedTiresId"] = "";
                Session["SelectedProductId"] = "";
            }

        }
        else
        {
            pageSize = 5;
            if (TotalItemsR > 0)
            {
                PgrLots.DrawPager(CurrentPage, TotalItemsR, pageSize, MaxPagesToShow);

            }
            if (TotalItemsR > 0)
            {

                this.pgrTires.DrawPager(CurrentPageR, TotalItemsR, pageSize, MaxPagesToShow);
            }
            if (TotalItemsR > 0)
            {
                this.pgrProduct.DrawPager(CurrentPageR, TotalItemsR, pageSize, MaxPagesToShow);
            }



        }

    }
    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;

    }
예제 #21
0
    /// <summary>
    /// Use to get the selected load details from Load dataset of popup
    /// </summary>
    /// <param name="_LoadIds"></param>
    private void getLoads(string _deliveryIds)
    {

        //DataTable dtGetAll = dt;
        //dtGetAll.DefaultView.RowFilter = "[deliveryId] in (" + _deliveryIds + ")";
        //DataTable dtOutput = dtGetAll.DefaultView.ToTable();
        //gvInvoicesinfo.DataSource = dtOutput;
        DataSet ds = Invoice.getDeliveryInvoices(UserOrganizationId, _deliveryIds);

        gvInvoicesinfo.DataSource = ds;
        gvInvoicesinfo.DataBind();
        if (ds != null & ds.Tables.Count > 0)
        {
            int orgId = Conversion.ParseInt(ds.Tables[0].Rows[0]["OrganizationId"]);
            OrganizationInfo objOrg = new OrganizationInfo(orgId);
            lblOrgName.Text = objOrg.LegalName;
            lblOrgstreet.Text = objOrg.Address;
            lblOrgstate.Text = (objOrg.City == string.Empty ? "" : objOrg.City + ", ") + (string.IsNullOrEmpty(objOrg.StateName) ? "" : objOrg.StateName + ", ") + (string.IsNullOrEmpty(objOrg.ZipCode) ? "" : objOrg.ZipCode);
            lblInvoiceDate.Text = DateTime.Now.ToShortDateString();
            lnkbtnAddInvoice.Visible = true;
        }
    }
    protected void viewStakeholdersForApproval()
    {
        OrganizationInfo organizationInfo = new OrganizationInfo(OrganizationID, true);
        int status = OrganizationInfo.getStewardshipStatusByOrganizationId(OrganizationID, standardstewardshipIds, organizationInfo.OrganizationTypeId);
        OrganizationStatus s = (OrganizationStatus)status;
        if (status == 1)
            imgBtnPending.Visible = false;
        else if (status == 2)
            imgbtnApprove.Visible = false;
        else if (status == 3)
            imgbtnReject.Visible = false;
        else if (status == 4)
            imgbtnDelete.Visible = false;

        
        lblStatusNotes.Text = (OrganizationInfo.getLatestNotesStatusByOrganizationId(OrganizationID));
        lblStatus.Text = s.ToString();
        ltrBusinessName.Text = organizationInfo.LegalName;
        txtBusinessName.Text = organizationInfo.LegalName;
        ltrDBAName.Text = organizationInfo.DBAName;
        txtDBAName.Text = organizationInfo.DBAName;
        ltrFirstName.Text = organizationInfo.FirstName;
        txtFirstName.Text = organizationInfo.FirstName;
        ltrLastName.Text = organizationInfo.LastName;
        txtLastName.Text = organizationInfo.LastName;
        ltrprimaryEmail.Text = organizationInfo.Email;
        txtPrimaryEmail.Text = organizationInfo.Email;
        ltrPhoneNumber.Text = organizationInfo.BusinessNumber;
        txtPhoneNumber.Text = organizationInfo.BusinessNumber;
        ltrPhoneExtension.Text = organizationInfo.BusinessExtension;
        txtPhoneExtension.Text = organizationInfo.BusinessExtension;
        ltrCellPhoneNumber.Text = organizationInfo.CellNumber;
        txtCellPhoneNumber.Text = organizationInfo.CellNumber;
        ltrCellPhoneExtension.Text = organizationInfo.CellExtension;
        txtCellPhoneExtension.Text = organizationInfo.CellExtension;
        ltrZipCode.Text = organizationInfo.ZipCode;
        txtZipCode.Text = organizationInfo.ZipCode;
        txtZipCode.Enabled = false;
        hdnBusinessZipCodeId.Value = Conversion.ParseString(organizationInfo.ZipCodeID);
        ltrState.Text = organizationInfo.StateName;
        ltrCountry.Text = organizationInfo.CountryName;
        ddlCountry.SelectedValue = Conversion.ParseString(organizationInfo.CountryID);
        ddlState.SelectedValue = Conversion.ParseString(organizationInfo.StateID);

        ltrCity.Text = organizationInfo.City;
        txtCity.Text = organizationInfo.City;
        txtCity.Enabled = false;
        ltrOrganization.Text = organizationInfo.OrganizationType;
        txtOrganization.Text = organizationInfo.OrganizationType;
        ltrContactTitle.Text = organizationInfo.ContactTitleName;
        txtContactTitle.Text = organizationInfo.ContactTitleName;
        ddlCountry.Enabled = false;
        ltrBusinessType.Text = organizationInfo.OrganizationSubType;
        txtBusinessType.Text = organizationInfo.OrganizationSubType;
        
        ltrwebsite.Text = organizationInfo.Website;
        txtWebsite.Text = organizationInfo.Website;
        ltrBusinessAddress1.Text = organizationInfo.BusinessAddress;
        txtBusinessAddress1.Text = organizationInfo.BusinessAddress;
        ltrBusinessAddress2.Text = organizationInfo.AlternativeAddress;
        txtBusinessAddress2.Text = organizationInfo.AlternativeAddress;
        ltrBusinessPhoneType.Text = organizationInfo.BusinessPhoneType;
        txtBusinessPhoneType.Text = organizationInfo.BusinessPhoneType;
        lrtBusinessTextMessage.Text = (organizationInfo.AcceptTextMessages) ? "Yes" : "No";
        if (organizationInfo.AcceptTextMessages) ddlbusinesstextmsgs.SelectedValue = "1"; else ddlbusinesstextmsgs.SelectedValue = "2";


        ltrAddress.Text = organizationInfo.Address;
        txtAddress.Text = organizationInfo.Address;
        ltrBillingContact.Text = organizationInfo.BillingContact;
        txtBillingContact.Text = organizationInfo.BillingContact;
        ltrFax.Text = organizationInfo.Fax;
        txtFax.Text = organizationInfo.Fax;
        ltrCountryAbbreviation.Text = organizationInfo.Abbreviation;
        txtCountryAbbreviation.Text = organizationInfo.Abbreviation;
        ltrCellTextMessage.Text = (organizationInfo.CellAcceptTextMessages) ? "Yes" : "No";
        if (organizationInfo.CellAcceptTextMessages) dddlcelltextmsgs.SelectedValue = "1"; else dddlcelltextmsgs.SelectedValue = "2";
        ltrCellPhoneType.Text = organizationInfo.CellPhoneType;
        txtCellPhoneType.Text = organizationInfo.CellPhoneType;
        ltrBillingMailAddress.Text = organizationInfo.BillMailAddress;
        txtBillingMailAddress.Text = organizationInfo.BillMailAddress;

    }
    protected void lnkBtnStepStewardship_Click(object sender, EventArgs e)
    {


        ///we need to add this fields in database via Lookup managament. Right now we are sending Hardcode id 1
        if (Utils.IsNumeric(hdnOrganizationID.Value) == false)
            return;
        OrganizationInfo ObjOrg = new OrganizationInfo();
        ObjOrg.OrganizationId = Convert.ToInt32(hdnOrganizationID.Value);
        ObjOrg.CertificationID = new List<int>();

        //        bool IsCertifiedInspector = false;
        //foreach (RepeaterItem rptItem in rptStakeCertificates.Items)
        //{
        //    if (((CheckBox)rptItem.FindControl("chk")).Checked)
        //    {
        //        HiddenField hid = (HiddenField)rptItem.FindControl("hdnID");
        //        if (hid.Value == "16")
        //            IsCertifiedInspector = true;
        ObjOrg.CertificationID.Add(1);
        //    }
        //}

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

        OrganizationInfo.SaveCertifications(ObjOrg);
        //if (IsCertifiedInspector)
        //    ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "Step3", "DisableInspectorTab();", true);
        //else
        //{
        //ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "Step3", "DisableInspectorTab();", true);
        ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "Step3", "GotoNextStep(3,'Stewardships');", true);
        //}


        //Utils.GetLookUpData<DropDownList>(ref ddlRoleList, LookUps.RoleName, Conversion.ParseInt(ddlOrganizationType.SelectedValue));
    }
예제 #24
0
		public static void SaveBasicInfo(OrganizationInfo ObjOrg, ContactInfo objContactInfo, Phones objPhones)
		{
			try
			{
				using (DbManager DB = DbManager.GetDbManager())
				{
					List<SqlParameter> prm = new List<SqlParameter>();

					if (ObjOrg.OrganizationId > 0)
						prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, ObjOrg.OrganizationId));
					else
						prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, DBNull.Value));

					prm.Add(DB.MakeInParam("@LegalName", SqlDbType.NVarChar, 255, ObjOrg.LegalName));
					prm.Add(DB.MakeInParam("@DBAName", SqlDbType.NVarChar, 255, ObjOrg.DBAName));
					prm.Add(DB.MakeInParam("@FranchiseName", SqlDbType.NVarChar, 255, ObjOrg.FranchiseName));
					if(ObjOrg.BusinessType != null)
						prm.Add(DB.MakeInParam("@BusinessType", SqlDbType.VarChar, -1, String.Join<int>(",", ObjOrg.BusinessType)));
					else
						prm.Add(DB.MakeInParam("@BusinessType", SqlDbType.VarChar, -1, DBNull.Value));
					prm.Add(DB.MakeInParam("@OrgIsActive", SqlDbType.Bit, 1, ObjOrg.IsActive));
					prm.Add(DB.MakeInParam("@OrganizationTypeId", SqlDbType.Int, 4, ObjOrg.OrganizationTypeId));
                    prm.Add(DB.MakeInParam("@OrganizationSubTypeId", SqlDbType.Int, 4, ObjOrg.OrganizationSubTypeID));
					prm.Add(DB.MakeInParam("@ParentId", SqlDbType.Int, 4, ObjOrg.ParentId));
					prm.Add(DB.MakeInParam("@Website", SqlDbType.NVarChar, 255, ObjOrg.Website));
					prm.Add(DB.MakeInParam("@TX_ID", SqlDbType.NVarChar, 90, ObjOrg.TX_ID));
					prm.Add(DB.MakeInParam("@OrgLanguageId", SqlDbType.Int, 4, ObjOrg.LanguageId));
					prm.Add(DB.MakeInParam("@AgencyType", SqlDbType.Int, 4, ObjOrg.AgencyType));
					prm.Add(DB.MakeInParam("@RoleId", SqlDbType.Int, 4, ObjOrg.RoleId));

					prm.Add(DB.MakeInParam("@PhoneId", SqlDbType.Int, 4, objPhones.PhoneId));
					prm.Add(DB.MakeInParam("@Number", SqlDbType.NVarChar, 15, objPhones.Number));
					prm.Add(DB.MakeInParam("@Extension", SqlDbType.NVarChar, 7, objPhones.Extension));
					prm.Add(DB.MakeInParam("@PhoneTypeId", SqlDbType.Int, 4, objPhones.PhoneTypeId));
					prm.Add(DB.MakeInParam("@PhoneIsActive", SqlDbType.Bit, 1, objPhones.IsActive));

					prm.Add(DB.MakeInParam("@ContactId", SqlDbType.Int, 4, objContactInfo.ContactId));
					prm.Add(DB.MakeInParam("@ContactTypeId", SqlDbType.Int, 4, objContactInfo.ContactTypeId));
					prm.Add(DB.MakeInParam("@FirstName", SqlDbType.NVarChar, 30, objContactInfo.FirstName));
					prm.Add(DB.MakeInParam("@MiddleName", SqlDbType.NVarChar, 10, objContactInfo.MiddleName));
					prm.Add(DB.MakeInParam("@LastName", SqlDbType.NVarChar, 30, objContactInfo.LastName));
					prm.Add(DB.MakeInParam("@Email", SqlDbType.NVarChar, 90, objContactInfo.Email));
					prm.Add(DB.MakeInParam("@IsPrimary", SqlDbType.Bit, 1, objContactInfo.IsPrimary));
					prm.Add(DB.MakeInParam("@ContactIsActive", SqlDbType.Bit, 1, objContactInfo.IsActive));
					prm.Add(DB.MakeInParam("@ContactLanguageId", SqlDbType.Int, 4, objContactInfo.LanguageId));

					//prm.Add(DB.MakeInParam("@LocationID", SqlDbType.Int, 4, ObjOrg.LocationID));
					//prm.Add(DB.MakeInParam("@Description", SqlDbType.NVarChar, 100, ObjOrg.Description));
					//prm.Add(DB.MakeInParam("@Address", SqlDbType.NVarChar, 250, ObjOrg.Address));
					//prm.Add(DB.MakeInParam("@City", SqlDbType.NVarChar, 100, ObjOrg.City));
					//prm.Add(DB.MakeInParam("@StateId", SqlDbType.Int, 4, ObjOrg.StateID));
					//prm.Add(DB.MakeInParam("@CountryID", SqlDbType.Int, 4, ObjOrg.CountryID));
					//prm.Add(DB.MakeInParam("@ZipPostalCode", SqlDbType.NVarChar, 100, ObjOrg.ZipPostalCode));
					//prm.Add(DB.MakeInParam("@AddressIsActive", SqlDbType.Bit, 1, ObjOrg.IsActive));
					//prm.Add(DB.MakeInParam("@DateCreated", SqlDbType.DateTime, 8, ObjOrg.DateCreated));
					//prm.Add(DB.MakeInParam("@BillMailAddress", SqlDbType.NVarChar, 250, ObjOrg.BillMailAddress));
					//prm.Add(DB.MakeInParam("@OwnerManager", SqlDbType.NVarChar, 50, ObjOrg.OwnerManager));
					//prm.Add(DB.MakeInParam("@BilingContact", SqlDbType.NVarChar, 50, ObjOrg.BillingContact));
					//prm.Add(DB.MakeInParam("@Fax", SqlDbType.NVarChar, 20, ObjOrg.Fax));

					ObjOrg.OrganizationId = DB.RunProc("up_OrganizationInsertUpdateBasicInfo", prm.ToArray());
				}
			}
			catch (Exception ex)
			{
				new SqlLog().InsertSqlLog(0, "OrganizationInfo.SaveBasicInfo", ex);
			}
		}
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //chk
            DataBindInputControls();
            LoadDropDown();

            OrganizationInfo ObjOrg = new OrganizationInfo();

            rptStakeCertificates.DataSource = ObjOrg.GetAllCertificatesByType(StewardshipCertifications); //old value is 1 
            rptStakeCertificates.DataBind();

            //rptTireCertificates.DataSource = ObjOrg.GetAllCertificatesByType(StakeholderCertifications); // older value is 2 
            //rptTireCertificates.DataBind();

            DataSet ds = Product.GetProductNames();
            chkProductId.DataSource = ds;
            chkProductId.DataBind();
            //DataSet dss = OrganizationInfo.GetOrganizationSubTypes();
            //ddlOrganizationSubType.DataSource = dss;
            //ddlOrganizationSubType.DataBnd();

            if (Request.QueryString["OrganizationId"] != null && Utils.IsNumeric(Request.QueryString["OrganizationId"]))
            {
                LoadInfo(Convert.ToInt32(Request.QueryString["OrganizationId"]));
            }
            else
            {
                DataTable dt = new DataTable();
                gvSupplier.DataSource = dt;
                gvSupplier.DataBind();
                LoadHeaderTextForSupplier();

                gvClient.DataSource = dt;
                gvClient.DataBind();
                LoadHeaderTextForClient();

                gvAdditionLocations.DataSource = dt;
                gvAdditionLocations.DataBind();
                LoadHeaderTextForAddLocations();

                dt.Dispose();
                dt = null;
            }
            chkLocationTemporary.Attributes.Add("onclick", String.Format("return ValidateChecked(this, '{0}', true, true, false);", chkLocationPermanent.ClientID));
            chkLocationPermanent.Attributes.Add("onclick", String.Format("return ValidateChecked(this, '{0}', true, true, false);", chkLocationTemporary.ClientID));
            //.Enabled = false;
            //txtLocationToDate.Enabled = false;
            loadAgreement();
            if (ddlOrganizationType.SelectedItem.Text.ToString().Trim().ToLower() == "stewardship")
            {
                orgsubType.Visible = false;
            }
        }
        if (!string.IsNullOrEmpty(HttpContext.Current.Request.Cookies["CultureCookie"]["UICulture"]))
        {
            Utils.SetCulture(HttpContext.Current.Request.Cookies["CultureCookie"]["UICulture"].ToString(), HttpContext.Current.Request.Cookies["CultureCookie"]["UICulture"].ToString());
        }
        //if (hdnOrganizationID.Value != null)
        //{
        //    if(Conversion.ParseInt(hdnOrganizationID.Value)>0)
        //    Utils.GetLookUpData<DropDownList>(ref ddlRoleList, LookUps.RoleName, Conversion.ParseInt(hdnOrganizationID.Value));
        //} 
        lblStewardshipExists.Visible = false;
        lblSupplierStatus.Visible = false;
    }
예제 #26
0
		public static void SavePrimaryInfo(OrganizationInfo objOrg, ContactInfo objPrimaryContact, Phones objPrimaryContactBusinessPhone, 
            Phones objPrimaryContactCellPhone, ContactInfo objBillingContact, Phones objBillingContactBusinessPhone, Phones objBillingContactCellPhone, 
            Organization_Address objBusinessOrganization_Address, Organization_Address objMailingOrganization_Address, string catIds)
		{
			try
			{
				using (DbManager DB = DbManager.GetDbManager())
				{
					List<SqlParameter> prm = new List<SqlParameter>();

					#region Organization Info

					if (objOrg.OrganizationId > 0)
						prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, objOrg.OrganizationId));
					else
						prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, DBNull.Value));
					prm.Add(DB.MakeInParam("@LegalName", SqlDbType.NVarChar, 255, objOrg.LegalName));
					prm.Add(DB.MakeInParam("@DBAName", SqlDbType.NVarChar, 255, objOrg.DBAName));
					prm.Add(DB.MakeInParam("@OrganizationTypeId", SqlDbType.Int, 4, objOrg.OrganizationTypeId));
                    prm.Add(DB.MakeInParam("@OrganizationSubTypeId", SqlDbType.Int, 0, objOrg.OrganizationSubTypeID));
					prm.Add(DB.MakeInParam("@Website", SqlDbType.NVarChar, 255, objOrg.Website));
					prm.Add(DB.MakeInParam("@AccountingInterfaceId", SqlDbType.Int, 4, objOrg.AccountingInterfaceId));
					prm.Add(DB.MakeInParam("@InventoryInterfaceId", SqlDbType.Int, 4, objOrg.InventoryInterfaceId));
					prm.Add(DB.MakeInParam("@IsAutoFundTransfer", SqlDbType.Bit, 1, objOrg.IsAutoFundTransfer));
					prm.Add(DB.MakeInParam("@OrgIsActive", SqlDbType.Bit, 1, objOrg.IsActive));
					prm.Add(DB.MakeInParam("@OrgLanguageId", SqlDbType.Int, 4, objOrg.LanguageId));
					prm.Add(DB.MakeInParam("@RoleId", SqlDbType.Int, 4, objOrg.RoleId));

					#endregion

					#region Primary Contact Info

					prm.Add(DB.MakeInParam("@PrimaryContactTypeId", SqlDbType.Int, 4, objPrimaryContact.ContactTypeId));
					prm.Add(DB.MakeInParam("@PrimaryContactFirstName", SqlDbType.NVarChar, 255, objPrimaryContact.FirstName));
					prm.Add(DB.MakeInParam("@PrimaryContactLastName", SqlDbType.NVarChar, 255, objPrimaryContact.LastName));
					prm.Add(DB.MakeInParam("@PrimaryContactTitleId", SqlDbType.Int, 4, objPrimaryContact.ContactTitleId));
					prm.Add(DB.MakeInParam("@PrimaryContactEmail", SqlDbType.NVarChar, 200, objPrimaryContact.Email));
					prm.Add(DB.MakeInParam("@PrimaryContactIsActive", SqlDbType.Bit, 1, objPrimaryContact.IsActive));
					prm.Add(DB.MakeInParam("@PrimaryContactIsPrimary", SqlDbType.Bit, 1, objPrimaryContact.IsPrimary));
					prm.Add(DB.MakeInParam("@PrimaryContactLanguageId", SqlDbType.Int, 4, objPrimaryContact.LanguageId));

					#endregion

					#region Primary Contact Business Phone Info

					prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactBusinessPhone.Number));
					prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneExtension", SqlDbType.NVarChar, 7, objPrimaryContactBusinessPhone.Extension));
					prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactBusinessPhone.PhoneTypeId));
					prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactBusinessPhone.IsActive));

					#endregion

					#region Primary Contact Cell Phone Info

					prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactCellPhone.Number));
					prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsAcceptTextMessages", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsAcceptTextMessages));
					prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactCellPhone.PhoneTypeId));
					prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsActive));

					#endregion

					#region Billing Contact Info

					prm.Add(DB.MakeInParam("@BillingContactTypeId", SqlDbType.Int, 4, objBillingContact.ContactTypeId));
					prm.Add(DB.MakeInParam("@BillingContactFirstName", SqlDbType.NVarChar, 255, objBillingContact.FirstName));
					prm.Add(DB.MakeInParam("@BillingContactLastName", SqlDbType.NVarChar, 255, objBillingContact.LastName));
					prm.Add(DB.MakeInParam("@BillingContactTitleId", SqlDbType.Int, 4, objBillingContact.ContactTitleId));
					prm.Add(DB.MakeInParam("@BillingContactEmail", SqlDbType.NVarChar, 200, objBillingContact.Email));
					prm.Add(DB.MakeInParam("@BillingContactIsActive", SqlDbType.Bit, 1, objBillingContact.IsActive));
					prm.Add(DB.MakeInParam("@BillingContactIsPrimary", SqlDbType.Bit, 1, objBillingContact.IsPrimary));
					prm.Add(DB.MakeInParam("@BillingContactLanguageId", SqlDbType.Int, 4, objBillingContact.LanguageId));

					#endregion

					#region Billing Contact Business Phone Info

					prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneNumber", SqlDbType.NVarChar, 15, objBillingContactBusinessPhone.Number));
					prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneExtension", SqlDbType.NVarChar, 7, objBillingContactBusinessPhone.Extension));
					prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneTypeId", SqlDbType.Int, 4, objBillingContactBusinessPhone.PhoneTypeId));
					prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneIsActive", SqlDbType.Bit, 1, objBillingContactBusinessPhone.IsActive));

					#endregion

					#region Billing Contact Cell Phone Info

					prm.Add(DB.MakeInParam("@BillingContactCellPhoneNumber", SqlDbType.NVarChar, 15, objBillingContactCellPhone.Number));
					prm.Add(DB.MakeInParam("@BillingContactCellPhoneIsAcceptTextMessages", SqlDbType.Bit, 1, objBillingContactCellPhone.IsAcceptTextMessages));
					prm.Add(DB.MakeInParam("@BillingContactCellPhoneTypeId", SqlDbType.Int, 4, objBillingContactCellPhone.PhoneTypeId));
					prm.Add(DB.MakeInParam("@BillingContactCellPhoneIsActive", SqlDbType.Bit, 1, objBillingContactCellPhone.IsActive));

					#endregion

					#region Business Organization Address Info

					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCodeId", SqlDbType.Int, 4, objBusinessOrganization_Address.ZipCodeID));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCode", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.ZipPostalCode));
					prm.Add(DB.MakeInParam("@BusinessOrganizationAddress1", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address1));
					prm.Add(DB.MakeInParam("@BusinessOrganizationAddress2", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address2));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCity", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.City));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressStateId", SqlDbType.Int, 4, objBusinessOrganization_Address.StateID));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCountryID", SqlDbType.Int, 4, objBusinessOrganization_Address.CountryID));
                    prm.Add(DB.MakeInParam("@BusinessOrganization_CityId", SqlDbType.BigInt, 10, objBusinessOrganization_Address.CityId));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressIsActive", SqlDbType.Bit, 1, objBusinessOrganization_Address.IsActive));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressDateCreated", SqlDbType.DateTime, 8, objBusinessOrganization_Address.DateCreated));
					prm.Add(DB.MakeInParam("@BusinessOrganization_AddressTypeId", SqlDbType.Int, 4, objBusinessOrganization_Address.Organization_AddressTypeId));

					#endregion

					#region Mailing Organization Address Info

					prm.Add(DB.MakeInParam("@MailingOrganization_AddressZipCodeId", SqlDbType.Int, 4, objMailingOrganization_Address.ZipCodeID));
					prm.Add(DB.MakeInParam("@MailingOrganization_AddressZipCode", SqlDbType.NVarChar, 100, objMailingOrganization_Address.ZipPostalCode));
					prm.Add(DB.MakeInParam("@MailingOrganizationAddress1", SqlDbType.NVarChar, 250, objMailingOrganization_Address.Address1));
					prm.Add(DB.MakeInParam("@MailingOrganizationAddress2", SqlDbType.NVarChar, 250, objMailingOrganization_Address.Address2));
					prm.Add(DB.MakeInParam("@MailingOrganization_AddressCity", SqlDbType.NVarChar, 100, objMailingOrganization_Address.City));
                    prm.Add(DB.MakeInParam("@MailingOrganization_CityId", SqlDbType.BigInt, 10, objMailingOrganization_Address.CityId));
					prm.Add(DB.MakeInParam("@MailingOrganization_AddressStateId", SqlDbType.Int, 4, objMailingOrganization_Address.StateID));
					prm.Add(DB.MakeInParam("@MailingOrganization_AddressCountryID", SqlDbType.Int, 4, objMailingOrganization_Address.CountryID));
					prm.Add(DB.MakeInParam("@MailingOrganization_AddressIsActive", SqlDbType.Bit, 1, objMailingOrganization_Address.IsActive));
					prm.Add(DB.MakeInParam("@MailingOrganization_AddressDateCreated", SqlDbType.DateTime, 8, objMailingOrganization_Address.DateCreated));
					prm.Add(DB.MakeInParam("@MailingOrganization_AddressTypeId", SqlDbType.Int, 4, objMailingOrganization_Address.Organization_AddressTypeId));

					#endregion

                    //For making application generalized
                    prm.Add(DB.MakeInParam("@CategoryIds", SqlDbType.VarChar, 50, catIds));

					objOrg.OrganizationId = DB.RunProc("up_OrganizationInsertUpdatePrimaryInfo", prm.ToArray());
				}
			}
			catch (Exception ex)
			{
				new SqlLog().InsertSqlLog(0, "OrganizationInfo.SaveBasicInfo", ex);
			}
		}
    protected void gvLatestSteward_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Approve")
        {

            OrganizationInfo o = new OrganizationInfo(Convert.ToInt32(e.CommandArgument));
            standardIds = System.Configuration.ConfigurationManager.AppSettings["StewardshipStandardIDs"];
            OrganizationInfo.SetStatus(OrganizationStatus.Accepted, o.OrganizationId, "Approved from dashboard", o.OrganizationTypeId, standardIds);
            DataSet ds = UserInfo.getDefaultUsers(o.OrganizationId);
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {

                UserInfo user = new UserInfo(Convert.ToInt32(ds.Tables[0].Rows[0]["UserId"].ToString()));
                if (!user.IsApproved)
                {
                    Emails email = new Emails();
                    email.To = user.Login;
                    email.URL = ConfigurationManager.AppSettings["EmailUrl"].ToString() + "ChangePassword.aspx?userId=" + Encryption.Encrypt(user.UserId.ToString());
                    email.From = "*****@*****.**";
                    email.Subject = "Registration Approval Email";
                    //If thread doesnt works then uncomment the commented area below and comment 2 lines of threading.
                    Thread Email_Thread = new Thread(() => SendEmails(email, Emails.EmailType.ApplicationApprovedEmail.ToString()));
                    Email_Thread.Start();
                    //SendEmails(email, Emails.EmailType.ApplicationApprovedEmail.ToString());
                }
            }
            Response.Redirect("/Dashboard/admindashboard.aspx");//,false);
            //Context.ApplicationInstance.CompleteRequest();
        }

    }
    protected void lnkBtnStep2_Click(object sender, EventArgs e)
    {
        if (Utils.IsNumeric(hdnOrganizationID.Value) == false)
            return;

        OrganizationInfo ObjOrg = new OrganizationInfo();

        ObjOrg.OrganizationId = Convert.ToInt32(hdnOrganizationID.Value);

        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));
        //    }
        //}

        OrganizationInfo.SaveCertifications(ObjOrg);
        ResourceLinkButton lnkBtn = (ResourceLinkButton)sender;
        if (lnkBtn.ID == "lnkBtnStep2")
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Step4", "GotoNextStep(4,'Stakeholders');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Step3", "GotoNextStep(3,'Stewardships');", true);
        }

        
    }