Exemplo n.º 1
0
        /// <summary>
        /// DeleteAddressContext - Will do a soft delete (make inactive) by AddrID
        /// </summary>
        /// <param name="_cAddress"></param>
        public void DeleteAddressContext(sp_Vol_Address_DM _cAddress, sp_Vol_Addr_DM _cVolAddr)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                try
                {
                    var AddrToRemove = (from n in context.tblVolAddrs where n.AddrID == _cVolAddr.AddrID select n).FirstOrDefault();
                    if (AddrToRemove != null)
                        context.tblVolAddrs.Remove(AddrToRemove);
                    context.SaveChanges();

                    var AddressToRemove = (from n in context.tblVolAddresses where n.AddrID == _cAddress.AddrID select n).FirstOrDefault();
                    //context.tblVolAddresses.Remove(AddressToRemove);
                    AddressToRemove.ActiveFlg = false;
                    if (AddressToRemove != null)
                        context.sp_Vol_Address_Update(AddressToRemove.AddrID, AddressToRemove.ActiveFlg, AddressToRemove.AddrLine1,
                            AddressToRemove.AddrLine2, AddressToRemove.AddrLine3, AddressToRemove.City, AddressToRemove.St, AddressToRemove.Zip,
                            AddressToRemove.Zip4, AddressToRemove.GeoCodeGetSet);
                    context.SaveChanges();

                }
                catch (Exception ex)
                {
                    throw (ex);
                }

            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// DeleteAddressContext - Will do a soft delete (make inactive) by AddrID
        /// </summary>
        /// <param name="_cAddress"></param>
        public void DeleteAddressContext(sp_Vol_Address_DM _cAddress)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                var AddressToRemove = (from n in context.tblVolAddresses where n.AddrID == _cAddress.AddrID select n).FirstOrDefault();
                context.tblVolAddresses.Remove(AddressToRemove);
                context.SaveChanges();

            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// DeleteAddressContext - Remove from cache and call delete method in BLL.
        /// </summary>
        /// <param name="_cAddress"></param>
        /// <param name="_cVolAddr"></param>
        public void DeleteAddressContext(sp_Vol_Address_DM _cAddress, sp_Vol_Addr_DM _cVolAddr)
        {
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_Vol_Address_DM cacheAddress;
            cacheAddress = (sp_Vol_Address_DM)cache[RecordType.VolAddr + _cVolAddr.VolID.ToString() + _cAddress.AddrID.ToString()];

            if (cacheAddress != null)
            {
                cache.Remove(RecordType.VolAddr + "|" + _cVolAddr.VolID.ToString() + "|" + _cAddress.AddrID.ToString());
            }
            BLL.DeleteAddressContext(_cAddress, _cVolAddr);
        }
        public void DeleteAddressContext(sp_Vol_Address_DM _cAddress)
        {
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_Vol_Address_DM cacheAddress;
            cacheAddress = (sp_Vol_Address_DM)cache[_cAddress.AddrID.ToString()];

            if (cacheAddress != null)
            {
                cache.Remove(_cAddress.AddrID.ToString());
            }
            BLL.DeleteAddressContext(_cAddress);
        }
Exemplo n.º 5
0
        public static void InsertVolAddressData(TestContext testContext)
        {
            System.Diagnostics.Debug.WriteLine(String.Format("{0}", DateTime.Now));
            cExcel.RemoveAllData();
            cExcel.InsertData(ExcelFilenames);

            sp_Volunteer_BLL volBLL = new sp_Volunteer_BLL();
            generalTestVol = new sp_Volunteer_DM();
            generalTestVol.VolFirstName = "TestFirst";
            generalTestVol.VolMiddleName = "TestMiddle";
            generalTestVol.VolLastName = "TestLast";
            generalTestVol.ActiveFlg = true;
            generalTestVol.VolID = Guid.NewGuid();
            volBLL.InsertVolunteerContext(ref generalTestVol);

            sp_Vol_Address_BLL volAddress_bll = new sp_Vol_Address_BLL();
            primaryTestVolAddress = new sp_Vol_Address_DM();
            primaryTestVolAddress.AddrLine1 = "PrimaryLine1";
            primaryTestVolAddress.AddrLine2 = "PrimaryLine2";
            primaryTestVolAddress.AddrLine3 = "PrimaryLine3";
            primaryTestVolAddress.City = "PrimaryCity";
            primaryTestVolAddress.St = "PS";
            primaryTestVolAddress.Zip = 12345;
            primaryTestVolAddress.Zip4 = 6789;
            primaryTestVolAddress.VolID = generalTestVol.VolID;
            primaryTestVolAddress.ActiveFlg = true;
            primaryTestVolAddress.PrimaryAddr = true;

            primaryTestVolAddr = new sp_Vol_Addr_DM();
            primaryTestVolAddr.VolID = generalTestVol.VolID;
            primaryTestVolAddr.PrimaryAddr = true;

            volAddress_bll.InsertAddressContext(ref primaryTestVolAddress, ref primaryTestVolAddr);

            secondaryTestVolAddress = new sp_Vol_Address_DM();
            secondaryTestVolAddress.AddrLine1 = "SecondaryLine1";
            secondaryTestVolAddress.AddrLine2 = "SecondaryLine2";
            secondaryTestVolAddress.AddrLine3 = "SecondaryLine3";
            secondaryTestVolAddress.City = "SecondaryCity";
            secondaryTestVolAddress.St = "SS";
            secondaryTestVolAddress.Zip = 98765;
            secondaryTestVolAddress.Zip4 = 4321;
            secondaryTestVolAddress.VolID = generalTestVol.VolID;
            secondaryTestVolAddress.ActiveFlg = true;
            secondaryTestVolAddress.PrimaryAddr = false;

            secondaryTestVolAddr = new sp_Vol_Addr_DM();
            secondaryTestVolAddr.VolID = generalTestVol.VolID;
            secondaryTestVolAddr.PrimaryAddr = false;
            volAddress_bll.InsertAddressContext(ref secondaryTestVolAddress, ref secondaryTestVolAddr);
        }
        public void UpdateAddressContext(sp_Vol_Address_DM _cAddress)
        {
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_Vol_Address_DM cacheAddress;
            cacheAddress = (sp_Vol_Address_DM)cache[_cAddress.AddrID.ToString()];

            if (cacheAddress != null)
            {
                cache.Remove(_cAddress.AddrID.ToString());
            }

            cache.Insert(_cAddress.AddrID.ToString(), _cAddress, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            BLL.UpdateAddressContext(_cAddress);
        }
Exemplo n.º 7
0
        /// <summary>
        /// InsertAddressContext - Will insert a record into Address table via SProc
        /// </summary>
        /// <param name="_cAddress"></param>
        public void InsertAddressContext(ref sp_Vol_Address_DM _cAddress, ref sp_Vol_Addr_DM _cVolAddr)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                try
                {
                    var cAddress = new tblVolAddress
                    {
                        AddrLine1 = _cAddress.AddrLine1,
                        AddrLine2 = _cAddress.AddrLine2,
                        AddrLine3 = _cAddress.AddrLine3,
                        City = _cAddress.City,
                        St = _cAddress.St,
                        Zip = _cAddress.Zip,
                        Zip4 = _cAddress.Zip4,
                        GeoCodeGetSet = _cAddress.GeoCodeGetSet,
                        ActiveFlg = _cAddress.ActiveFlg
                    };
                    context.tblVolAddresses.Add(cAddress);
                    context.SaveChanges();

                    var cVolAddr = new tblVolAddr
                    {
                        VolID = _cVolAddr.VolID,
                        AddrID = cAddress.AddrID,
                        PrimaryAddr = _cVolAddr.PrimaryAddr
                    };

                    context.tblVolAddrs.Add(cVolAddr);
                    context.SaveChanges();

                    //If the AddrID isn't null, set it equal to the return value
                    if (cAddress.AddrID != null)
                        _cAddress.AddrID = cAddress.AddrID;

                    if (cVolAddr.AddrID != null)
                        _cVolAddr.AddrID = cVolAddr.AddrID;
                }
                catch (Exception ex)
                {
                    throw (ex);
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// InsertAddressContext - Will insert a record into Address table via SProc
        /// </summary>
        /// <param name="_cAddress"></param>
        public void InsertAddressContext(sp_Vol_Address_DM _cAddress)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                var cAddress = new tblVolAddress
                {
                    AddrID = _cAddress.AddrID,
                    AddrLine1 = _cAddress.AddrLine1,
                    AddrLine2 = _cAddress.AddrLine2,
                    AddrLine3 = _cAddress.AddrLine3,
                    City = _cAddress.City,
                    St = _cAddress.St,
                    Zip = _cAddress.Zip,
                    Zip4 = _cAddress.Zip4,
                    ActiveFlg = _cAddress.ActiveFlg

                };
                context.tblVolAddresses.Add(cAddress);
                context.SaveChanges();
            }
        }
Exemplo n.º 9
0
        public sp_Vol_Address_DM hCreateVolAddress(string AddrLine1,string AddrLine2,string AddrLine3,string City,string State,Nullable<int> Zip,Nullable<int> Zip4,bool PrimaryAddr,Guid VolID)
        {
            sp_Vol_Address_DM VolAddress = new sp_Vol_Address_DM();
            sp_Vol_Addr_DM VolAddr = new sp_Vol_Addr_DM();
            sp_Vol_Address_BLL VolAddressBll = new sp_Vol_Address_BLL();

            VolAddress.AddrLine1 = AddrLine1;
            VolAddress.AddrLine2 = AddrLine2;
            VolAddress.AddrLine3 = AddrLine3;
            VolAddress.City = City;
            VolAddress.St = State;
            VolAddress.Zip = Zip;
            VolAddress.Zip4 = Zip4;

            VolAddr.VolID = VolID;
            VolAddr.PrimaryAddr = PrimaryAddr;

            VolAddressBll.InsertAddressContext(ref VolAddress,ref VolAddr);

            return VolAddress;
        }
Exemplo n.º 10
0
        /// <summary>
        /// ListAddress - There's a good chance the same record may be requested often.  Cache the address object...
        /// 
        /// </summary>
        /// <param name="Address"></param>
        /// <returns></returns>
        public sp_Vol_Address_DM ListAddresses(int? Address)
        {
            sp_Vol_Address_DM cAddress = new sp_Vol_Address_DM();

            //Cache cache = HttpRuntime.Cache;
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_Vol_Address_DM cacheAddress;
            cacheAddress = (sp_Vol_Address_DM)cache[Address.ToString()];

            if (cacheAddress == null)
            {
                cAddress = BLL.ListAddresses(Address);
                cache.Insert(cAddress.AddrID.ToString(), cAddress, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            else
            {
                cAddress = cacheAddress;
            }

            return cAddress;
        }
Exemplo n.º 11
0
        public void DeleteAddressContext(sp_Vol_Address_DM _cAddress, sp_GroupAddr_DM _cGroupAddr)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                try
                {
                    var AddrToRemove = (from n in context.tblGroupAddrs where n.AddrID == _cGroupAddr.AddrID select n).FirstOrDefault();
                    context.tblGroupAddrs.Remove(AddrToRemove);
                    context.SaveChanges();

                    var AddressToRemove = (from n in context.tblVolAddresses where n.AddrID == _cAddress.AddrID select n).FirstOrDefault();
                    context.tblVolAddresses.Remove(AddressToRemove);
                    context.SaveChanges();

                }
                catch (Exception ex)
                {
                    throw (ex);
                }

            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// rGridAddress_NeedDataSource - Called when the grid needs a data source
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rGridAddress_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            try
            {
                sp_Vol_Address_DM VolDM = new sp_Vol_Address_DM();
                VolDM.VolID = (Guid)currentUser.ProviderUserKey;
                //rGridAddress.DataSource = VolAddrBLL.ListAddresses(VolDM);

                rGridAddress.DataSource = VolAddrCash.ListAddresses(VolDM);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                string errMethod = sf.GetMethod().Name.ToString();  // Get the current method name
                string errMsg = "600";                              // Gotta pass something, we're retro-fitting an existing method
                Session["LastException"] = ex;                      // Throw the exception in the session variable, will be used in error page
                string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                Response.Redirect(url);                             // Go to the error page.

            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// rGridAdress_UpdIns - Handle update/insert in a common procedure
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="iAction"></param>
        protected void rGridAdress_UpdIns(object sender, GridCommandEventArgs e, int iAction)
        {
            try
            {
                GridEditableItem eeditedItem = e.Item as GridEditableItem;

                sp_Vol_Address_DM VolAddressDM = new sp_Vol_Address_DM();
                sp_Vol_Addr_DM VolAddrDM = new sp_Vol_Addr_DM();

                VolAddrDM.VolID = (Guid)currentUser.ProviderUserKey; ;

                VolAddressDM.VolID = (Guid)currentUser.ProviderUserKey;
                if (iAction == (int)RecordAction.Update)
                {
                    VolAddressDM.AddrID = Convert.ToInt32(eeditedItem.OwnerTableView.DataKeyValues[eeditedItem.ItemIndex]["AddrID"]);
                    pre_ID = Convert.ToInt32(eeditedItem.OwnerTableView.DataKeyValues[eeditedItem.ItemIndex]["AddrID"]);
                    VolAddrDM.AddrID = Convert.ToInt32(eeditedItem.OwnerTableView.DataKeyValues[eeditedItem.ItemIndex]["AddrID"]);
                }
                VolAddressDM.ActiveFlg = (eeditedItem.FindControl("chkActive") as CheckBox).Checked;
                VolAddrDM.PrimaryAddr = (eeditedItem.FindControl("chkPrimaryAddr") as CheckBox).Checked;

                VolAddressDM.AddrLine1 = (eeditedItem.FindControl("rTBAddr1") as RadTextBox).Text.ToString();
                VolAddressDM.AddrLine2 = (eeditedItem.FindControl("rTBAddr2") as RadTextBox).Text.ToString();
                VolAddressDM.AddrLine3 = (eeditedItem.FindControl("rTBAddr3") as RadTextBox).Text.ToString();
                VolAddressDM.City = (eeditedItem.FindControl("rTBCity") as RadTextBox).Text.ToString();
                VolAddressDM.St = (eeditedItem.FindControl("rDDSt") as RadDropDownList).SelectedValue.ToString();
                VolAddressDM.Zip = Convert.ToInt32((eeditedItem.FindControl("rNTBZip") as RadNumericTextBox).Text);
                string strZip4 = ((eeditedItem.FindControl("rNTBZip4") as RadNumericTextBox).Text).ToString();
                if (strZip4 == string.Empty)
                {
                    VolAddressDM.Zip4 = null;
                }
                else
                {
                    VolAddressDM.Zip4 = Convert.ToInt32(strZip4.ToString());
                }
                //TODO - Test to see if GeoCode works without USA at end
                //   VolAddressDM.GeoCodeGetSet = GetGeoCode(VolAddressDM);

                if (iAction == (int)RecordAction.Update)
                {
                    VolAddrBLL.UpdateAddressContext(VolAddressDM, VolAddrDM);

                }
                else if (iAction == (int)RecordAction.Insert)
                {
                    VolAddrBLL.InsertAddressContext(ref VolAddressDM, ref VolAddrDM);
                }
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                string errMethod = sf.GetMethod().Name.ToString();  // Get the current method name
                string errMsg = "600";                              // Gotta pass something, we're retro-fitting an existing method
                Session["LastException"] = ex;                      // Throw the exception in the session variable, will be used in error page
                string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                Response.Redirect(url);                             // Go to the error page.
            }

            try
            {
                HandleScreenLoad();
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                string errMethod = sf.GetMethod().Name.ToString();  // Get the current method name
                string errMsg = "600";                              // Gotta pass something, we're retro-fitting an existing method
                Session["LastException"] = ex;                      // Throw the exception in the session variable, will be used in error page
                string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                Response.Redirect(url);                             // Go to the error page.
            }
        }
Exemplo n.º 14
0
        protected void HandleScreenLoad()
        {
            currentUser = Membership.GetUser();

            pnlSingleAddress.Visible = false;
            pnlAddressGrid.Visible = true;
            sp_Vol_Address_DM VolDM = new sp_Vol_Address_DM();
            VolDM.VolID = (Guid)currentUser.ProviderUserKey;
            //rGridAddress.DataSource = VolAddrBLL.ListAddresses(VolDM);

            rGridAddress.DataSource = VolAddrCash.ListAddresses(VolDM);
            rGridAddress.DataBind();
        }
Exemplo n.º 15
0
        /// <summary>
        /// rGridAddress_DeleteCommand - Handle the delete command
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rGridAddress_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            sp_Vol_Address_DM VolAddressDM = new sp_Vol_Address_DM();
            sp_Vol_Addr_DM VolAddrDM = new sp_Vol_Addr_DM();

            try
            {
                VolAddressDM.VolID = (Guid)currentUser.ProviderUserKey;
                VolAddressDM.AddrID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["AddrID"];

                VolAddrDM.VolID = (Guid)currentUser.ProviderUserKey;
                VolAddrDM.AddrID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["AddrID"];

                VolAddrBLL.DeleteAddressContext(VolAddressDM, VolAddrDM);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                string errMethod = sf.GetMethod().Name.ToString();  // Get the current method name
                string errMsg = "600";                              // Gotta pass something, we're retro-fitting an existing method
                Session["LastException"] = ex;                      // Throw the exception in the session variable, will be used in error page
                string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                Response.Redirect(url);                             // Go to the error page.

            }
        }
Exemplo n.º 16
0
 public void UpdateAddressContext(sp_Vol_Address_DM _cAddress, sp_Vol_Addr_DM _cVolAddr)
 {
     DAL.UpdateAddressContext(_cAddress, _cVolAddr);
 }
Exemplo n.º 17
0
        protected string GetGeoCode(sp_Vol_Address_DM VolAddr)
        {
            GoogleAddress googleAddress = new GoogleAddress();
            googleAddress.FormattedAddress = VolAddr.AddrLine1 + ", " +
               VolAddr.City + ", " + VolAddr.St + " " + VolAddr.Zip;
            //Assume we want to send the request to Google using SSL
            IGeocoder geoCoder = new GoogleGeocoder(true);
            String geoCoderXML = geoCoder.GetLatLongFromAddress(googleAddress);
            String latitude;
            String longitude;

            using (XmlReader reader = XmlReader.Create(new StringReader(geoCoderXML)))
            {
                reader.ReadToFollowing("lat");
                reader.MoveToFirstAttribute();
                latitude = reader.Value;

                reader.ReadToFollowing("lon");
                longitude = reader.Value;
            }

            String gcReturn;
            if (latitude.Contains("unknown") || longitude.Contains("unknown"))
            {
                gcReturn = null;
            }
            else
            {
                gcReturn = "'POINT(" + longitude + " " + latitude + ")'";
            }

            return gcReturn;
        }
Exemplo n.º 18
0
 public List<sp_Vol_Address_DM> ListAddresses(sp_Vol_Address_DM cVolAddr)
 {
     return DAL.ListAddresses(cVolAddr);
 }
Exemplo n.º 19
0
 /// <summary>
 /// ListPrimaryAddress - List the Primary address
 /// </summary>
 /// <param name="cVolAddr"></param>
 /// <returns></returns>
 public sp_Vol_Address_DM ListPrimaryAddress(sp_Vol_Address_DM cVolAddr)
 {
     return DAL.ListPrimaryAddress(cVolAddr);
 }
Exemplo n.º 20
0
 public void InsertAddressContext(ref sp_Vol_Address_DM _cAddress, ref sp_Vol_Addr_DM _cVolAddr)
 {
     DAL.InsertAddressContext(ref _cAddress, ref _cVolAddr);
 }
Exemplo n.º 21
0
 public sp_Vol_Address_DM ListAddress(sp_Vol_Address_DM cVolAddr)
 {
     return ListAddresses(cVolAddr).SingleOrDefault();
 }
Exemplo n.º 22
0
        /// <summary>
        /// Returns a list of all addresses
        /// </summary>
        /// <returns></returns>
        public List<sp_Vol_Address_DM> ListAddresses(sp_Vol_Address_DM cVolAddr)
        {
            List<sp_Vol_Address_DM> list = new List<sp_Vol_Address_DM>();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    list = (from result in context.sp_Vol_Address_Select(cVolAddr.VolID, cVolAddr.AddrID, null)
                            select new sp_Vol_Address_DM
                            {
                                AddrID = result.AddrID,
                                ActiveFlg = result.ActiveFlg,
                                AddrLine1 = result.AddrLine1,
                                AddrLine2 = result.AddrLine2,
                                AddrLine3 = result.AddrLine3,
                                City = result.City,
                                St = result.St,
                                Zip = result.Zip,
                                Zip4 = result.Zip4,
                                GeoCodeGetSet = result.GeoCodeGetSet,
                                PrimaryAddr = result.PrimaryAddr,
                                VolID = cVolAddr.VolID

                            }).ToList();
                } // Guaranteed to close the Connection
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return list;
        }
Exemplo n.º 23
0
 public void InsertAddressContext(sp_Vol_Address_DM _cAddress)
 {
     DAL.InsertAddressContext(_cAddress);
 }
Exemplo n.º 24
0
        /// <summary>
        /// SetPrimaryValues - Paint the screen with default values (use non-telerik controls)
        /// </summary>
        protected void SetPrimaryValues()
        {
            sp_Vol_Address_DM VolDM = new sp_Vol_Address_DM();
            StringBuilder sb = new StringBuilder();

            try
            {
                VolDM.VolID = (Guid)currentUser.ProviderUserKey;
                VolDM = VolAddrCash.ListPrimaryAddress(VolDM);

                lblAddr1.Text = VolDM.AddrLine1;
                lblAddr2.Text = VolDM.AddrLine2;
                if (string.IsNullOrEmpty(lblAddr2.Text))
                {
                    rowAddr2.Visible = false;
                }
                else
                {
                    rowAddr2.Visible = true;
                }

                lblAddr3.Text = VolDM.AddrLine3;
                if (string.IsNullOrEmpty(lblAddr3.Text))
                {
                    rowAddr3.Visible = false;
                }
                else
                {
                    rowAddr3.Visible = true;
                }

                sb.Clear();
                sb.Append(VolDM.City.ToString());
                sb.Append(", ");
                sb.Append(VolDM.St.ToString());
                sb.Append("   ");
                sb.Append(VolDM.Zip.ToString());
                if (!string.IsNullOrEmpty(VolDM.Zip4.ToString()))
                {
                    sb.Append('-');
                    sb.Append(VolDM.Zip4.ToString());
                }

                lblCityStZip.Text = sb.ToString();
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                string errMethod = sf.GetMethod().Name.ToString();  // Get the current method name
                string errMsg = "600";                              // Gotta pass something, we're retro-fitting an existing method
                Session["LastException"] = ex;                      // Throw the exception in the session variable, will be used in error page
                string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                Response.Redirect(url);                             // Go to the error page.
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// UpdateAddressContext - Will update a given Address record by AddrID
        /// </summary>
        /// <param name="_cAddress"></param>
        public void UpdateAddressContext(sp_Vol_Address_DM _cAddress, sp_Vol_Addr_DM _cVolAddr)
        {
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    var cAddress = context.tblVolAddresses.Find(_cAddress.AddrID);
                    var cVolAddr = context.tblVolAddrs.Find(_cVolAddr.VolID,_cVolAddr.AddrID);

                    if (cAddress != null)
                    {
                        cAddress.AddrLine1 = _cAddress.AddrLine1;
                        cAddress.AddrLine2 = _cAddress.AddrLine2;
                        cAddress.AddrLine3 = _cAddress.AddrLine3;
                        cAddress.City = _cAddress.City;
                        cAddress.St = _cAddress.St;
                        cAddress.Zip = _cAddress.Zip;
                        cAddress.Zip4 = _cAddress.Zip4;
                        cAddress.ActiveFlg = _cAddress.ActiveFlg;
                        cAddress.GeoCodeGetSet = _cAddress.GeoCodeGetSet;
                    }

                    if (cVolAddr != null)
                    {
                        cVolAddr.VolID = _cVolAddr.VolID;
                        cVolAddr.AddrID = _cVolAddr.AddrID;
                        cVolAddr.PrimaryAddr = _cVolAddr.PrimaryAddr;
                    }

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 26
0
        public sp_Vol_Address_DM ListPrimaryAddress(sp_Vol_Address_DM cVolAddr)
        {
            sp_Vol_Address_DM item = new sp_Vol_Address_DM();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    item = (from result in context.sp_Vol_Address_Select(cVolAddr.VolID, null, true)
                            select new sp_Vol_Address_DM
                            {
                                AddrID = result.AddrID,
                                ActiveFlg = result.ActiveFlg,
                                AddrLine1 = result.AddrLine1,
                                AddrLine2 = result.AddrLine2,
                                AddrLine3 = result.AddrLine3,
                                City = result.City,
                                St = result.St,
                                Zip = result.Zip,
                                Zip4 = result.Zip4,
                                GeoCodeGetSet = result.GeoCodeGetSet,
                                PrimaryAddr = result.PrimaryAddr,
                                VolID = cVolAddr.VolID

                            }).FirstOrDefault();
                } // Guaranteed to close the Connection
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return item;
        }
Exemplo n.º 27
0
 public void DeleteAddressContext(sp_Vol_Address_DM _cAddress)
 {
     DAL.DeleteAddressContext(_cAddress);
 }
Exemplo n.º 28
0
        /// <summary>
        /// SetPrimaryValues - Paint the screen with default values (use non-telerik controls)
        /// </summary>
        protected void SetPrimaryValues()
        {
            //setup and bind all 3 primary values
            currentUser = Membership.GetUser();
            sp_Vol_Address_DM address_DM = new sp_Vol_Address_DM();
            sp_Email_DM email_DM = new sp_Email_DM();
            sp_Phone_DM phone_DM = new sp_Phone_DM();
            StringBuilder sb = new StringBuilder();

            try
            {
                //email code
                email_DM.VolID = (Guid)currentUser.ProviderUserKey;
                email_DM = VolEmailCache.ListPrimaryEmail(email_DM);
                if (email_DM != null)
                {
                    PrimaryEmail.Text = email_DM.EmailAddr;
                }
                else
                {
                    PrimaryEmail.Text = "-- NONE --";
                }

                //phone code
                phone_DM.VolID = (Guid)currentUser.ProviderUserKey;
                phone_DM = VolPhoneCache.ListPrimaryPhone(phone_DM);

                if (phone_DM != null)
                {
                    PrimaryPhone.Text = phone_DM.PhoneNbr;
                }
                else
                {
                    PrimaryPhone.Text = "-- NONE --";
                }

                //address code
                address_DM.VolID = (Guid)currentUser.ProviderUserKey;
                address_DM = VolAddrCash.ListPrimaryAddress(address_DM);

                sb.Clear();
                if (address_DM != null)
                {
                    sb.Append(address_DM.AddrLine1.ToString());
                    sb.Append(" ");
                    if (!string.IsNullOrEmpty(address_DM.AddrLine2))
                    {
                        sb.Append(address_DM.AddrLine2.ToString());
                        sb.Append(" ");
                    }
                    if (!string.IsNullOrEmpty(address_DM.AddrLine3))
                    {
                        sb.Append(address_DM.AddrLine3.ToString());
                        sb.Append(" ");
                    }
                    sb.Append(", ");
                    sb.Append(address_DM.City.ToString());
                    sb.Append(" ");
                    sb.Append(address_DM.St.ToString());
                    sb.Append(",  ");
                    sb.Append(address_DM.Zip.ToString());
                    if (!string.IsNullOrEmpty(address_DM.Zip4.ToString()))
                    {
                        sb.Append('-');
                        sb.Append(address_DM.Zip4.ToString());
                    }
                }
                PrimaryAddress.Text = sb.ToString();

            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                string errMethod = sf.GetMethod().Name.ToString();  // Get the current method name
                string errMsg = "600";                              // Gotta pass something, we're retro-fitting an existing method
                Session["LastException"] = ex;                      // Throw the exception in the session variable, will be used in error page
                string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                Response.Redirect(url);                             // Go to the error page.
            }
        }
Exemplo n.º 29
0
 public void UpdateAddressContext(sp_Vol_Address_DM _cAddress)
 {
     DAL.UpdateAddressContext(_cAddress);
 }
Exemplo n.º 30
0
 public void DeleteAddressContext(sp_Vol_Address_DM _cAddress, sp_Vol_Addr_DM _cVolAddr)
 {
     DAL.DeleteAddressContext(_cAddress, _cVolAddr);
 }