예제 #1
0
        public static void PMSaveAddress(object AddressInfo)
        {
            iAddressInfoClient AddressClient = new iAddressInfoClient();

            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                SP_GetAddressListToBindGrid_Result Address = new SP_GetAddressListToBindGrid_Result();

                if (Sequence != "" && Sequence != "0")
                {
                    Address          = AddressClient.GetAddressTempDataBySequence(Convert.ToInt64(Sequence), sessionID, TargetObject, profile.Personal.UserID.ToString(), profile.DBConnection._constr);
                    Address.Sequence = Convert.ToInt64(Sequence);
                }
                else
                {
                    Address.Sequence = 0;
                }
                Dictionary <string, object> rec = new Dictionary <string, object>();
                rec = (Dictionary <string, object>)AddressInfo;

                Address.ObjectName  = TargetObject;
                Address.ReferenceID = Convert.ToInt64(Sequence);
                Address.AddressType = "none";

                Address.AddressLine1  = rec["AddressLine1"].ToString();
                Address.AddressLine2  = rec["AddressLine2"].ToString();
                Address.AddressLine3  = rec["AddressLine3"].ToString();
                Address.RouteID       = Convert.ToInt64(rec["RouteID"].ToString());
                Address.Landmark      = rec["Landmark"].ToString();
                Address.County        = rec["County"].ToString();
                Address.State         = rec["State"].ToString();
                Address.Zone          = rec["Zone"].ToString();    //new add
                Address.SubZone       = rec["SubZone"].ToString(); //new add
                Address.City          = rec["City"].ToString();
                Address.Zipcode       = rec["Zipcode"].ToString();
                Address.PhoneNo       = rec["PhoneNo"].ToString();
                Address.FaxNo         = rec["FaxNo"].ToString();
                Address.EmailID       = rec["EmailID"].ToString();
                Address.Active        = "N";// Active Use for Is Archive
                Address.CompanyID     = profile.Personal.CompanyID;
                Address.ShipIsChecked = "false";
                Address.BillIsChecked = "false";
                Address.IsDefault     = "N";
                if (Sequence != "0" && Sequence != "")
                {
                    AddressClient.SetValuesToTempData_onChange(sessionID, profile.Personal.UserID.ToString(), TargetObject, Convert.ToInt32(Sequence), Address, profile.DBConnection._constr);
                }
                else
                {
                    AddressClient.InsertIntoTemp(Address, sessionID, profile.Personal.UserID.ToString(), TargetObject, profile.DBConnection._constr);
                }
                AddressClient.Close();
            }
            catch (System.Exception ex)
            {
                AddressClient.Close();
                Login.Profile.ErrorHandling(ex, thispage, "AddressInfo", "PMSaveAddress");
            }
        }
예제 #2
0
        public SP_GetAddressListToBindGrid_Result GetAddressTempDataBySequence(long SequenceNo, string SessionID, string TargetObjectName, string UserID, string[] conn)
        {
            List <SP_GetAddressListToBindGrid_Result> AddressList = new List <SP_GetAddressListToBindGrid_Result>();

            AddressList = GetAddressTempData(TargetObjectName, SessionID, UserID, conn);

            SP_GetAddressListToBindGrid_Result Address = new SP_GetAddressListToBindGrid_Result();

            //Address = AddressList.Where(add => add.Active != "Y").FirstOrDefault();
            Address = AddressList.Where(add => add.Sequence == SequenceNo).FirstOrDefault();

            return(Address);
        }
예제 #3
0
        public void SetAddressArchive(string Ids, string isDeleted, string userId, string TargetObjectName, string SessionID, string[] conn)
        {
            List <SP_GetAddressListToBindGrid_Result> AddressList = new List <SP_GetAddressListToBindGrid_Result>();

            AddressList = GetAddressTempData(TargetObjectName, SessionID, userId, conn);

            string[] SeqArr = Ids.Split(',');

            int[] SeqInts = SeqArr.Select(x => int.Parse(x)).ToArray();

            for (int i = 0; i < SeqInts.Length; i++)
            {
                SP_GetAddressListToBindGrid_Result address = new SP_GetAddressListToBindGrid_Result();
                address        = AddressList.Where(a => a.Sequence == SeqInts[i]).FirstOrDefault();
                address.Active = isDeleted;
            }

            SaveTempDataToDB(AddressList, SessionID, userId, TargetObjectName, conn);
        }
예제 #4
0
        public void SetValuesToTempData_onChange(string SessionID, string UserID, string TargetObjectName, int Sequence, SP_GetAddressListToBindGrid_Result paraInput, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            List <SP_GetAddressListToBindGrid_Result> existingList = new List <SP_GetAddressListToBindGrid_Result>();

            existingList = GetAddressTempData(TargetObjectName, SessionID, UserID, conn);

            SP_GetAddressListToBindGrid_Result editRow = new SP_GetAddressListToBindGrid_Result();

            editRow = (from exist in existingList
                       where exist.Sequence == Sequence
                       select exist).FirstOrDefault();
            editRow      = paraInput;
            existingList = existingList.Where(e => e.Sequence != Sequence).ToList();
            existingList.Add(editRow);
            existingList = (from e in existingList
                            orderby e.Sequence
                            select e).ToList();

            SaveTempDataToDB(existingList, SessionID, UserID, TargetObjectName, conn);
        }
예제 #5
0
        /// <summary>
        /// This Is Method ToInsert Record In to TempData table
        /// </summary>
        /// <param name="ContactPerson"></param>
        /// <param name="paraSessionID"></param>
        /// <param name="paraUserID"></param>
        /// <param name="paraObjectName"></param>
        /// <returns></returns>
        public void InsertIntoTemp(SP_GetAddressListToBindGrid_Result Address, string SessionID, string UserID, string TargetObjectName, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            /*Begin : Get Existing Records from TempData*/
            List <SP_GetAddressListToBindGrid_Result> existingAddressList = new List <SP_GetAddressListToBindGrid_Result>();

            existingAddressList = GetAddressTempData(TargetObjectName, SessionID, UserID, conn);
            /*End*/

            /*Begin : Merge (Existing + Newly Added) Products to Create TempData of AddToCart*/
            List <SP_GetAddressListToBindGrid_Result> mergedAddToAddressList = new List <SP_GetAddressListToBindGrid_Result>();

            mergedAddToAddressList.AddRange(existingAddressList);
            Address.Sequence = existingAddressList.Count + 1;
            mergedAddToAddressList.Add(Address);
            /*End*/

            /*Begin : Serialize & Save MergedAddToCartList*/
            SaveTempDataToDB(mergedAddToAddressList, SessionID, UserID, TargetObjectName, conn);
            /*End*/
        }
예제 #6
0
        protected void GetRecordFromTempDataBySequenceID(string SequenceNo)
        {
            SP_GetAddressListToBindGrid_Result Address = new SP_GetAddressListToBindGrid_Result();
            iAddressInfoClient AddressClient           = new iAddressInfoClient();

            try
            {
                lblAddressFormHeader.Text = "Add New Address Info";
                if (SequenceNo != "0")
                {
                    if (sessionID == null)
                    {
                        sessionID = Session.SessionID;
                    }
                    lblAddressFormHeader.Text = "Edit Address Info";
                    CustomProfile profile = CustomProfile.GetProfile();
                    Address = AddressClient.GetAddressTempDataBySequence(Convert.ToInt64(SequenceNo), sessionID, TargetObject, profile.Personal.UserID.ToString(), profile.DBConnection._constr);

                    txtAddress1.Text = Address.AddressLine1;
                    if (Address.AddressLine2 != null)
                    {
                        txtAddress2.Text = Address.AddressLine2;
                    }
                    if (Address.AddressLine3 != null)
                    {
                        txtAddress3.Text = Address.AddressLine3;
                    }
                    if (ddlRoute.Items.Count >= 1)
                    {
                        ddlRoute.SelectedIndex = 0;
                    }
                    if (Address.RouteID != null)
                    {
                        ddlRoute.SelectedIndex = ddlRoute.Items.IndexOf(ddlRoute.Items.FindByValue(Address.RouteID.ToString()));
                    }
                    if (Address.Landmark != null)
                    {
                        txtLandMark.Text = Address.Landmark;
                    }
                    Page.ClientScript.RegisterStartupScript(GetType(), "fillCountry" + sessionID, "setCountry('" + Address.County + "','" + Address.State + "','" + Address.Zone + "','" + Address.SubZone + "');", true);
                    txtcity.Text = Address.City;
                    if (Address.Zipcode != null)
                    {
                        txtPostalCode.Text = Address.Zipcode;
                    }
                    if (Address.Zipcode != null)
                    {
                        txtPostalCode.Text = Address.Zipcode;
                    }
                    if (Address.PhoneNo != null)
                    {
                        txtPhone.Text = Address.PhoneNo;
                    }
                    if (Address.PhoneNo != null)
                    {
                        txtPhone.Text = Address.PhoneNo;
                    }
                    if (Address.FaxNo != null)
                    {
                        txtFax.Text = Address.FaxNo;
                    }
                    if (Address.FaxNo != null)
                    {
                        txtFax.Text = Address.FaxNo;
                    }
                    if (Address.EmailID != null)
                    {
                        txtEmailID.Text = Address.EmailID;
                    }
                    //rbtnActiveYes.Checked = true;
                    //rbtnActiveNo.Checked = false;
                    //if (Address.Active == "N") { rbtnActiveYes.Checked = false; rbtnActiveNo.Checked = true; }
                }
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, this, "AddressInfo.aspx.cs", "GetRecordFromTempDataBySequenceID");
            }
            finally { AddressClient.Close(); }
        }