コード例 #1
0
    private void GetOrderDetails(int storeId, int portalId, int orderId, string cultureName)
    {
        try
        {
            OrderLabel orderDetail = GetOrderDetailByOrderId(orderId, storeId, portalId, cultureName);
            if (orderDetail != null)
            {
                AddressInfo billingAddress = GetUserBillingAddress(orderDetail.UserBillingAddressId);
                BindBillingAddress(billingAddress);
                int providerId = GetShippingProviderIdByShippingMethod(orderDetail.ShippingMethodId);
                Session["labelOrderInfo"]  = orderDetail;
                lblUserShippingMethod.Text = string.Format("{0}:{1}", "" + getLocale("User Selected Method:") + "",
                                                           orderDetail.ShippingMethodName);
                AddressInfo shippingAddress = GetUserShippingAddress(orderDetail.UserShippingAddressId, storeId,
                                                                     portalId);
                BindShippingAddress(shippingAddress);
                AspxCommerce.Core.WareHouseAddress wareHouseAddress = GetWareHouseAddress(storeId, portalId);

                BindWareHouseAddress(wareHouseAddress);

                BindPackageDetails(orderDetail);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #2
0
    private void BindWareHouseAddress(AspxCommerce.Core.WareHouseAddress wareHouseAddress)
    {
        StringBuilder billingAdr = new StringBuilder();

        billingAdr.Append("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\"><tr>");
        billingAdr.Append("<td>WareHouse Name:</td>");
        billingAdr.Append("<td>" + wareHouseAddress.Name + "</td></tr><tr>");
        billingAdr.Append("<td>Address:</td>");
        billingAdr.Append("<td>" + wareHouseAddress.Address + "</td></tr><tr>");
        if (!string.IsNullOrEmpty(wareHouseAddress.StreetAddress1))
        {
            billingAdr.Append("<td>Street Address1:</td>");
            billingAdr.Append("<td>" + wareHouseAddress.StreetAddress1 + "</td></tr><tr>");
        }
        if (!string.IsNullOrEmpty(wareHouseAddress.StreetAddress2))
        {
            billingAdr.Append("<td>Street Address2:</td>");
            billingAdr.Append("<td>" + wareHouseAddress.StreetAddress2 + "</td></tr><tr>");
        }
        billingAdr.Append("<td>Country:</td>");
        billingAdr.Append("<td>" + wareHouseAddress.Country + "</td></tr><tr>");
        billingAdr.Append("<td>City:</td>");
        billingAdr.Append("<td>" + wareHouseAddress.City + "</td></tr><tr>");
        billingAdr.Append("<td>State:</td>");
        billingAdr.Append("<td>" + wareHouseAddress.State + "</td></tr><tr>");
        billingAdr.Append("<td>ZipCode:</td>");
        billingAdr.Append("<td>" + wareHouseAddress.PostalCode + "</td></tr><tr>");
        billingAdr.Append("<td>Email Address:</td>");
        billingAdr.Append("<td>" + wareHouseAddress.Email + "</td></tr><tr>");
        billingAdr.Append("<td>Phone No:</td>");
        billingAdr.Append("<td>" + wareHouseAddress.Phone + "</td></tr>");
        billingAdr.Append("</table>");
        ltWareHouse.Text = billingAdr.ToString();
    }
コード例 #3
0
        private static WareHouseAddress GetWareHouseAddress(int storeId, int portalId)
        {
            SQLHandler sqlHandler = new SQLHandler();
            List <KeyValuePair <string, object> > paramList = new List <KeyValuePair <string, object> >();

            paramList.Add(new KeyValuePair <string, object>("@StoreID", storeId));
            paramList.Add(new KeyValuePair <string, object>("@PortalID", portalId));
            WareHouseAddress objWareHouse = sqlHandler.ExecuteAsObject <WareHouseAddress>("[usp_Aspx_GetActiveWareHouse]", paramList);

            return(objWareHouse);
        }
コード例 #4
0
 private AspxCommerce.Core.WareHouseAddress GetWareHouseAddress(int storeId, int portalId)
 {
     try
     {
         SQLHandler sqlHandler = new SQLHandler();
         List <KeyValuePair <string, object> > paramList = new List <KeyValuePair <string, object> >();
         paramList.Add(new KeyValuePair <string, object>("@StoreID", storeId));
         paramList.Add(new KeyValuePair <string, object>("@PortalID", portalId));
         AspxCommerce.Core.WareHouseAddress cl = sqlHandler.ExecuteAsObject <AspxCommerce.Core.WareHouseAddress>("[usp_Aspx_GetActiveWareHouse]",
                                                                                                                 paramList);
         return(cl);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                IncludeCss("OrderManagement", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/MessageBox/style.css");
                IncludeJs("OrderManagement", "/js/GridView/jquery.grid.js", "/js/GridView/SagePaging.js", "/js/GridView/jquery.global.js", "/js/GridView/jquery.dateFormat.js",
                          "/js/MessageBox/jquery.easing.1.3.js", "/js/MessageBox/alertbox.js", "/js/ExportToCSV/table2CSV.js", "/js/CurrencyFormat/jquery.formatCurrency-1.4.0.js",
                          "/js/CurrencyFormat/jquery.formatCurrency.all.js", "/Modules/AspxCommerce/AspxOrderManagement/js/OrderManagement.js");
                UserModuleID = SageUserModuleID;
                StoreID      = GetStoreID;
                PortalID     = GetPortalID;
                UserName     = GetUsername;
                CultureName  = GetCurrentCultureName;

                MembershipController member = new MembershipController();
                UserInfo             user   = member.GetUserDetails(GetPortalID, GetUsername);
                SenderEmail  = user.Email;
                templateName = TemplateName;
                StoreSettingConfig ssc = new StoreSettingConfig();
                StoreName   = ssc.GetStoreSettingsByKey(StoreSetting.StoreName, StoreID, PortalID, CultureName);
                NewOrderRss = ssc.GetStoreSettingsByKey(StoreSetting.NewOrderRss, StoreID, PortalID, CultureName);
                AllowRealTimeNotifications = ssc.GetStoreSettingsByKey(StoreSetting.AllowRealTimeNotifications, StoreID, PortalID, CultureName);
                if (AllowRealTimeNotifications.ToLower() == "true")
                {
                    IncludeJs("SignalR", false, "/js/SignalR/jquery.signalR-2.2.0.min.js", "/signalr/hubs", "/Modules/AspxCommerce/AspxStartUpEvents/js/RealTimeAspxMgmt.js");
                }
                if (NewOrderRss.ToLower() == "true")
                {
                    RssFeedUrl = ssc.GetStoreSettingsByKey(StoreSetting.RssFeedURL, StoreID, PortalID, CultureName);
                }
                AspxCommerce.Core.WareHouseAddress wareHouseAddress = GetWareHouseAddress(StoreID, PortalID);
                if (wareHouseAddress == null)
                {
                    WareHouseAddress = "null";
                }
            }
            IncludeLanguageJS();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
コード例 #6
0
    private void BindWareHouseAddress(AspxCommerce.Core.WareHouseAddress wareHouseAddress)
    {
        if (wareHouseAddress != null)
        {
            StringBuilder billingAdr = new StringBuilder();
            billingAdr.Append("<table><tr>");
            billingAdr.Append("<td>" + getLocale("WareHouse Name:") + "</td>");
            billingAdr.Append("<td>" + wareHouseAddress.Name + "</td></tr><tr>");
            billingAdr.Append("<td>" + getLocale("Address:") + "</td>");
            billingAdr.Append("<td>" + wareHouseAddress.Address + "</td></tr><tr>");
            if (!string.IsNullOrEmpty(wareHouseAddress.StreetAddress1))
            {
                billingAdr.Append("<td>" + getLocale("Street Address1:") + "</td>");
                billingAdr.Append("<td>" + wareHouseAddress.StreetAddress1 + "</td></tr><tr>");
            }
            if (!string.IsNullOrEmpty(wareHouseAddress.StreetAddress2))
            {
                billingAdr.Append("<td>" + getLocale("Street Address2:") + "</td>");
                billingAdr.Append("<td>" + wareHouseAddress.StreetAddress2 + "</td></tr><tr>");
            }
            billingAdr.Append("<td>" + getLocale("Country:") + "</td>");
            billingAdr.Append("<td>" + wareHouseAddress.Country + "</td></tr><tr>");
            billingAdr.Append("<td>" + getLocale("City:") + "</td>");
            billingAdr.Append("<td>" + wareHouseAddress.City + "</td></tr><tr>");
            billingAdr.Append("<td>" + getLocale("State:") + "</td>");
            billingAdr.Append("<td>" + wareHouseAddress.State + "</td></tr><tr>");
            billingAdr.Append("<td>" + getLocale("ZipCode:") + "</td>");
            billingAdr.Append("<td>" + wareHouseAddress.PostalCode + "</td></tr><tr>");
            billingAdr.Append("<td>" + getLocale("Email Address:") + "</td>");
            billingAdr.Append("<td>" + wareHouseAddress.Email + "</td></tr><tr>");
            billingAdr.Append("<td>" + getLocale("Phone No:") + "</td>");
            billingAdr.Append("<td>" + wareHouseAddress.Phone + "</td></tr>");
            billingAdr.Append("</table>");

            ltWareHouse.Text       = billingAdr.ToString();
            btnCreateLabel.Enabled = true;
        }
        else
        {
            Exception ex = new Exception("Please add warehouse address before shipping!");
            ShowError(ex);
            ltWareHouse.Text       = "<span>No WareHouse Address!</span>";
            btnCreateLabel.Enabled = false;
        }
    }
コード例 #7
0
 public static void AddUpDateWareHouse(WareHouseAddress wareHouse, AspxCommonInfo aspxCommonObj)
 {
     List<KeyValuePair<string, object>> paramCol = CommonParmBuilder.GetParamSPC(aspxCommonObj);
     paramCol.Add(new KeyValuePair<string, object>("@WareHouseID", wareHouse.WareHouseID));
     paramCol.Add(new KeyValuePair<string, object>("@IsPrimary", wareHouse.IsPrimary));
     paramCol.Add(new KeyValuePair<string, object>("@Name", wareHouse.Name));
     paramCol.Add(new KeyValuePair<string, object>("@StreetAddress1", wareHouse.StreetAddress1));
     paramCol.Add(new KeyValuePair<string, object>("@StreetAddress2", wareHouse.StreetAddress2));
     paramCol.Add(new KeyValuePair<string, object>("@City", wareHouse.City));
     paramCol.Add(new KeyValuePair<string, object>("@Country", wareHouse.Country));
     paramCol.Add(new KeyValuePair<string, object>("@State", wareHouse.State));
     paramCol.Add(new KeyValuePair<string, object>("@PostalCode", wareHouse.PostalCode));
     paramCol.Add(new KeyValuePair<string, object>("@Phone", wareHouse.Phone));
     paramCol.Add(new KeyValuePair<string, object>("@Fax", wareHouse.Fax));
     paramCol.Add(new KeyValuePair<string, object>("@Email", wareHouse.Email));
     paramCol.Add(new KeyValuePair<string, object>("@AddedBy", aspxCommonObj.UserName));
     SQLHandler sageSQL = new SQLHandler();
     sageSQL.ExecuteNonQuery("[usp_Aspx_InsertUpdateAspx_WareHouse]", paramCol);
 }
コード例 #8
0
        public static void AddUpDateWareHouse(WareHouseAddress wareHouse, AspxCommonInfo aspxCommonObj)
        {
            List <KeyValuePair <string, object> > paramCol = CommonParmBuilder.GetParamSPC(aspxCommonObj);

            paramCol.Add(new KeyValuePair <string, object>("WareHouseID", wareHouse.WareHouseID));
            paramCol.Add(new KeyValuePair <string, object>("IsPrimary", wareHouse.IsPrimary));
            paramCol.Add(new KeyValuePair <string, object>("Name", wareHouse.Name));
            paramCol.Add(new KeyValuePair <string, object>("StreetAddress1", wareHouse.StreetAddress1));
            paramCol.Add(new KeyValuePair <string, object>("StreetAddress2", wareHouse.StreetAddress2));
            paramCol.Add(new KeyValuePair <string, object>("City", wareHouse.City));
            paramCol.Add(new KeyValuePair <string, object>("Country", wareHouse.Country));
            paramCol.Add(new KeyValuePair <string, object>("State", wareHouse.State));
            paramCol.Add(new KeyValuePair <string, object>("PostalCode", wareHouse.PostalCode));
            paramCol.Add(new KeyValuePair <string, object>("Phone", wareHouse.Phone));
            paramCol.Add(new KeyValuePair <string, object>("Fax", wareHouse.Fax));
            paramCol.Add(new KeyValuePair <string, object>("Email", wareHouse.Email));
            paramCol.Add(new KeyValuePair <string, object>("AddedBy", aspxCommonObj.UserName));
            OracleHandler sageSQL = new OracleHandler();

            sageSQL.ExecuteNonQuery("usp_Aspx_InsertUpdateAspx_WareHouse", paramCol);
        }
コード例 #9
0
 private void GetOrderDetails(int storeId, int portalId, int orderId, string cultureName)
 {
     try
     {
         OrderLabel orderDetail = GetOrderDetailByOrderId(orderId, storeId, portalId, cultureName);
         if (orderDetail != null)
         {
             OriginAddress billingAddress = GetUserBillingAddress(orderDetail.UserBillingAddressId);
             BindBillingAddress(billingAddress);
             int providerId = GetShippingProviderIdByShippingMethod(orderDetail.ShippingMethodId);
             ProviderSetting(providerId, storeId, portalId);
             Session["labelOrderInfo"]  = orderDetail;
             lblUserShippingMethod.Text = string.Format("{0}:{1}", "User Selected Method:",
                                                        orderDetail.ShippingMethodName);
             DestinationAddress shippingAddress = GetUserShippingAddress(orderDetail.UserShippingAddressId, storeId, portalId);
             BindShippingAddress(shippingAddress);
             AspxCommerce.Core.WareHouseAddress wareHouseAddress = GetWareHouseAddress(storeId, portalId);
             BindWareHouseAddress(wareHouseAddress);
             if (shippingAddress.ToCountry != null && shippingAddress.ToCountry.ToLower().Trim() != "united states" && shippingAddress.ToCountry.ToLower().Trim() != wareHouseAddress.Country.ToLower().Trim())
             {
                 int count = rblLabelTypeList.Items.Count;
                 for (int i = 0; i < count; i++)
                 {
                     rblLabelTypeList.Items[i].Enabled = false;
                 }
                 rblLabelTypeList.Items.Add(new ListItem()
                 {
                     Text     = "International Label",
                     Selected = true,
                     Value    = "internationallabel"
                 });
             }
             BindPackageDetails(orderDetail);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
コード例 #10
0
    private void CreateLabel()
    {
        try
        {
            AddressInfo addInfo     = (AddressInfo)Session["sl_toAddress"];
            AddressInfo billAddInfo = (AddressInfo)Session["sl_frAddress"];
            AspxCommerce.Core.WareHouseAddress whaInfo = GetWareHouseAddress(GetStoreID, GetPortalID);
            _itemslist = new List <ItemDetail>();
            _itemslist = (List <ItemDetail>)Session["sl_items"];
            GeneratePDF.BasicPackageInfo basciPagIngo = new GeneratePDF.BasicPackageInfo();
            basciPagIngo.TrackingNo     = "";
            basciPagIngo.TotalWeight    = Convert.ToDecimal(lblPackageTotalWeight.Text);
            basciPagIngo.WeightUnit     = lblStoreWeightUnit.Text;
            basciPagIngo.WaterMark      = "";
            basciPagIngo.BarcodeNo      = "";
            basciPagIngo.SenderName     = billAddInfo.FirstName + " " + billAddInfo.LastName;
            basciPagIngo.CautionMessage = "Handle With Care.";
            basciPagIngo.ServiceType    = lblUserShippingMethod.Text;
            basciPagIngo.Length         = Convert.ToInt32(txtPackageLength.Text);
            basciPagIngo.Width          = Convert.ToInt32(txtPackageWidth.Text);
            basciPagIngo.Height         = Convert.ToInt32(txtPackageHeight.Text);
            basciPagIngo.DimensionUnit  = lblStoreDimensionUnit.Text;

            AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
            aspxCommonObj.StoreID     = GetStoreID;
            aspxCommonObj.PortalID    = GetPortalID;
            aspxCommonObj.UserName    = GetUsername;
            aspxCommonObj.CultureName = GetCurrentCultureName;
            GeneratePDF gPdf = new GeneratePDF();
            gPdf.CreateShipmentLabel(addInfo, whaInfo, aspxCommonObj, basciPagIngo);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #11
0
 public void AddUpDateWareHouse(WareHouseAddress wareHouse, AspxCommonInfo aspxCommonObj)
 {
     AspxWareHouseController.AddUpDateWareHouse(wareHouse, aspxCommonObj);
 }
コード例 #12
0
        public static List <CommonRateList> GetRate(ItemListDetails itemsDetail)
        {
            try
            {
                System.Net.ServicePointManager.Expect100Continue = false;
                var rateInfo = new List <CommonRateList>();
                //to get Dynamic Fuctions info
                List <MethodList> rateMethods = GetAllMethodsFromProvider(itemsDetail.CommonInfo.StoreID,
                                                                          itemsDetail.CommonInfo.PortalID);
                WareHouseAddress originAddress = GetWareHouseAddress(itemsDetail.CommonInfo.StoreID,
                                                                     itemsDetail.CommonInfo.PortalID);


                itemsDetail.WareHouseAddress = originAddress;


                if (itemsDetail.BasketItems.Count > 0)
                {
                    foreach (var method in rateMethods)
                    {
                        List <ParamList> paramList = GetParamsOfMethod(method.DynamicMethodId, itemsDetail.CommonInfo.StoreID, itemsDetail.CommonInfo.PortalID);
                        foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies())
                        {
                            Type type            = ass.GetType(method.NameSpace + "." + method.ClassName, false);
                            var  paramCollection = new List <object>();


                            if (type != null)
                            {
                                for (int i = 0; i < paramList.Count; i++)
                                {
                                    var param = ass.GetType(method.NameSpace + "." + paramList[i].ParameterName, false);
                                    //  Type listType = typeof (List<>).MakeGenericType(new Type[] {param});
                                    Type t = itemsDetail.GetType();

                                    if (param != null)
                                    {
                                        switch (paramList[i].ParameterType)
                                        {
                                        case "list":
                                            //itemslist
                                            var itemsList =
                                                DynamicUtility.TransferDataToList(itemsDetail.BasketItems,
                                                                                  itemsDetail,
                                                                                  param, method.AssemblyName);
                                            paramCollection.Add(itemsList);
                                            break;

                                        default:
                                            var pa = DynamicUtility.PassMembersValue(itemsDetail, param,
                                                                                     method.AssemblyName);
                                            paramCollection.Add(pa);
                                            break;
                                        }
                                    }
                                    if (param == null && paramList[i].ParameterName != "")
                                    {
                                        switch (paramList[i].ParameterName)
                                        {
                                        case "storeId":
                                            paramCollection.Add(itemsDetail.CommonInfo.StoreID);
                                            break;

                                        case "portalId":
                                            paramCollection.Add(itemsDetail.CommonInfo.PortalID);
                                            break;

                                        case "providerId":
                                            paramCollection.Add(method.ShippingProviderId);
                                            break;
                                        }
                                    }

                                    // Type listType1 = param1.MakeGenericType(new Type[] { param1 });
                                    //  ((method.ClassName) Activator.CreateInstance(Type.GetType(method.ClassName)));
                                    // DynamicUtility.Cast<listType>(originAddress);
                                }



                                //var obj = new Object[] {originAddress, da, packagedimension};

                                object     instance = Activator.CreateInstance(type);
                                MethodInfo fn       = type.GetMethod(method.MethodName);
                                var        obj      = paramCollection.ToArray();
                                System.Net.ServicePointManager.Expect100Continue = false;
                                var rateResponse = fn.Invoke(instance,
                                                             BindingFlags.InvokeMethod | BindingFlags.Public |
                                                             BindingFlags.Static,
                                                             null, obj, null);

                                List <CommonRateList> cl = DynamicUtility.CastToList <CommonRateList>(rateResponse);

                                //list of available shipping method of store
                                rateInfo.AddRange(cl);
                                break;
                            }
                        }
                    }
                }
                //GetProvidersAvailableMethod
                var allowedshippingMethods = GetProvidersAvailableMethod(itemsDetail.CommonInfo.StoreID,
                                                                         itemsDetail.CommonInfo.PortalID, itemsDetail.CommonInfo.CultureName);
                //filtering allowed shipping methods only
                var filterdmethods = new List <CommonRateList>();
                //  filterdmethods = rateInfo.Where(x => allowedshippingMethods.Any(y => x.ShippingMethodName == y.ShippingMethodName)).
                // ToList();

                AspxCommerceWebService    coreService = new AspxCommerceWebService();
                List <ShippingMethodInfo> flatRates   =
                    coreService.GetShippingMethodByWeight(itemsDetail.CommonInfo.StoreID,
                                                          itemsDetail.CommonInfo.PortalID,
                                                          itemsDetail.CommonInfo.
                                                          CustomerID,
                                                          itemsDetail.CommonInfo.UserName,
                                                          itemsDetail.CommonInfo.
                                                          CultureName,
                                                          itemsDetail.CommonInfo.
                                                          SessionCode);
                foreach (var item in flatRates)
                {
                    var cr = new CommonRateList
                    {
                        CurrencyCode       = "",
                        ImagePath          = item.ImagePath,
                        ShippingMethodId   = item.ShippingMethodID,
                        DeliveryTime       = item.DeliveryTime,
                        ShippingMethodName = item.ShippingMethodName,
                        TotalCharges       = decimal.Parse(item.ShippingCost)
                    };
                    //filterdmethods.Insert(0, cr);
                    filterdmethods.Add(cr);
                }

                foreach (var commonRateList in allowedshippingMethods)
                {
                    foreach (var info in rateInfo)
                    {
                        if (info.ShippingMethodName == commonRateList.ShippingMethodName)
                        {
                            var filterdmethod = info;
                            filterdmethod.ShippingMethodId = commonRateList.ShippingMethodID;
                            filterdmethods.Add(filterdmethod);
                            break;
                        }
                    }
                }


                return(filterdmethods);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #13
0
 public static void AddUpDateWareHouse(WareHouseAddress wareHouse, AspxCommonInfo aspxCommonObj)
 {
     AspxWareHouseProvider.AddUpDateWareHouse(wareHouse, aspxCommonObj);
 }
コード例 #14
0
 public static void AddUpDateWareHouse(WareHouseAddress wareHouse, AspxCommonInfo aspxCommonObj)
 {
     AspxWareHouseProvider.AddUpDateWareHouse(wareHouse, aspxCommonObj);
 }
コード例 #15
0
        public void CreateShipmentLabel(AddressInfo destinationAddress, WareHouseAddress wareHouseAddress, AspxCommonInfo aspxCommonObj, BasicPackageInfo basicPackageInfo)
        {
            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.AddHeader("content-disposition",
                                                   "attachment;filename=" + "ShipmentLabel_" +
                                                   DateTime.Now.ToString("M_dd_yyyy_H_M_s") + ".pdf");

            Document doc = new Document(iTextSharp.text.PageSize.A4, 0, 0, 20, 20);
            PdfWriter writer = PdfWriter.GetInstance(doc, HttpContext.Current.Response.OutputStream);

            writer.PageEvent = new MyPageEventHandler(basicPackageInfo.CautionMessage);
            doc.Open();
            var textFont = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL, new BaseColor(0, 0, 255));

            PdfPTable shipmentTalbe = new PdfPTable(2);
            shipmentTalbe.SetWidths(new int[2] {5, 15});
             
            //string cautionMessage = basicPackageInfo.CautionMessage;
            //PdfPCell verticalC = new PdfPCell(); //new PdfPCell(new Paragraph(cautionMessage, textFont));
            //verticalC.Rotation = 90;
            //// verticalC.VerticalAlignment = Element.ALIGN_CENTER;
            //verticalC.PaddingTop = 30f;
            //verticalC.PaddingBottom = 50f;
            //verticalC.Border = Rectangle.NO_BORDER;
            ////  shipmentTalbe.AddCell("");
            //shipmentTalbe.AddCell(verticalC);


            PdfPTable headerTbl = new PdfPTable(2);
            headerTbl.SetWidths(new int[2] {10, 15});
            float[] widths = new float[] { 200f,300f };
            // headerTbl.TotalWidth = doc.PageSize.Width;
            headerTbl.WidthPercentage = 100;

            Paragraph pa = new Paragraph("From",
                                         FontFactory.GetFont(FontFactory.TIMES_ROMAN, 16, Font.BOLD,
                                                             new BaseColor(0, 0, 255)));

            PdfPCell cell = new PdfPCell(pa);
            cell.PaddingLeft = 15f;
            //   pa.Alignment = Element.ALIGN_BOTTOM;
            cell.Border = Rectangle.NO_BORDER + Rectangle.RIGHT_BORDER;
            cell.AddElement(pa);

            PdfPTable fromTable = new PdfPTable(1);
            fromTable.WidthPercentage = 100;

            string fromAdd = string.Empty;
            if (!string.IsNullOrEmpty(wareHouseAddress.Name))
                fromAdd += wareHouseAddress.Name.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(wareHouseAddress.Address))
                fromAdd += wareHouseAddress.Address.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(wareHouseAddress.StreetAddress1))
                fromAdd += wareHouseAddress.StreetAddress1.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(wareHouseAddress.StreetAddress2))
                fromAdd += wareHouseAddress.StreetAddress2.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(wareHouseAddress.City))
                fromAdd += wareHouseAddress.City.Trim();
            if (!string.IsNullOrEmpty(wareHouseAddress.State))
                fromAdd += ", " + wareHouseAddress.State.Trim();
            if (!string.IsNullOrEmpty(wareHouseAddress.PostalCode))
                fromAdd += ", " + wareHouseAddress.PostalCode.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(wareHouseAddress.Country))
                fromAdd += wareHouseAddress.Country.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(wareHouseAddress.Phone))
                fromAdd += wareHouseAddress.Phone.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(wareHouseAddress.Fax))
                fromAdd += wareHouseAddress.Fax.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(wareHouseAddress.Email))
                fromAdd += wareHouseAddress.Email.Trim() + Environment.NewLine;

            PdfPCell fromAddcell = new PdfPCell(new Paragraph(fromAdd, textFont));
            fromAddcell.Border = Rectangle.NO_BORDER;
            fromAddcell.PaddingLeft = 30f;
            fromTable.AddCell(fromAddcell);
            cell.AddElement(fromTable);
            headerTbl.AddCell(cell);


            Paragraph to = new Paragraph("To",
                                         FontFactory.GetFont(FontFactory.TIMES_ROMAN, 16, Font.BOLD,
                                                             new BaseColor(0, 0, 255)));
            PdfPCell cellTo = new PdfPCell(to);
            cellTo.PaddingLeft = 15f;
            cellTo.Border = Rectangle.NO_BORDER;
            cellTo.AddElement(to);
            PdfPTable toTable = new PdfPTable(1);
            toTable.WidthPercentage = 100;
            string toAddress = string.Empty;
            if (!string.IsNullOrEmpty(destinationAddress.FirstName))
                toAddress += destinationAddress.FirstName.Trim() + " ";
            if (!string.IsNullOrEmpty(destinationAddress.LastName))
                toAddress += destinationAddress.LastName.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(destinationAddress.Company))
                toAddress += destinationAddress.Company.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(destinationAddress.Address1))
                toAddress += destinationAddress.Address1.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(destinationAddress.Address2))
                toAddress += destinationAddress.Address2.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(destinationAddress.City))
                toAddress += destinationAddress.City.Trim();
            if (!string.IsNullOrEmpty(destinationAddress.State))
                toAddress += ", " + destinationAddress.State.Trim();
            if (!string.IsNullOrEmpty(destinationAddress.Zip))
                toAddress += ", " + destinationAddress.Zip.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(destinationAddress.Country))
                toAddress += destinationAddress.Country.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(destinationAddress.Email))
                toAddress += destinationAddress.Email.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(destinationAddress.Phone))
                toAddress += destinationAddress.Phone.Trim();
            if (!string.IsNullOrEmpty(destinationAddress.Mobile))
                toAddress += ", " + destinationAddress.Mobile.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(destinationAddress.Fax))
                toAddress += destinationAddress.Fax.Trim() + Environment.NewLine;
            if (!string.IsNullOrEmpty(destinationAddress.Website))
                toAddress += destinationAddress.Website.Trim();
            PdfPCell toAddresscell = new PdfPCell(new Paragraph(toAddress, textFont));
            toAddresscell.Border = Rectangle.NO_BORDER;
            toAddresscell.PaddingLeft = 30f;
            toTable.AddCell(toAddresscell);
            cellTo.AddElement(toTable);
            headerTbl.AddCell(cellTo);

            var cellBackColor = new BaseColor(System.Drawing.ColorTranslator.FromHtml("#F4F8FC"));

            // for one line spacing
            PdfPCell blankCell1 = new PdfPCell();
            blankCell1.Colspan = 2;
            blankCell1.Border = Rectangle.NO_BORDER;
            // blankCell1.BackgroundColor = cellBackColor;
            headerTbl.AddCell(blankCell1);

            // For Tracking Number
            //PdfPCell trackingCell = new PdfPCell();
            //trackingCell.Colspan = 2;
            //trackingCell.Border = Rectangle.NO_BORDER;
            //Paragraph tracingPa = new Paragraph("Tracking No: " + basicPackageInfo.TrackingNo + "",
            //                                    FontFactory.GetFont(FontFactory.TIMES_ROMAN, 16, Font.BOLD,
            //                                                        new BaseColor(0, 0, 255)));
            //trackingCell.AddElement(tracingPa);
            //headerTbl.AddCell(trackingCell);

            // For one line spacing after tracking no.

            PdfPCell blankCell2 = new PdfPCell();
            blankCell2.Colspan = 2;
            blankCell2.Border = Rectangle.NO_BORDER;
            // blankCell2.BackgroundColor = cellBackColor;
            headerTbl.AddCell(blankCell2);

            // for total weight

            PdfPCell blankMiddleCell = new PdfPCell();
            blankMiddleCell.Border = Rectangle.NO_BORDER;
            headerTbl.AddCell(blankMiddleCell);
            string dimension = basicPackageInfo.Length + "*" + basicPackageInfo.Width + "*" + basicPackageInfo.Height +
                               " " + basicPackageInfo.DimensionUnit;
            Paragraph wtPa = new Paragraph("Total Weight: " + basicPackageInfo.TotalWeight + "" + Environment.NewLine
                                           + "Weight Unit: " + basicPackageInfo.WeightUnit + "" + Environment.NewLine
                                           + "Dimension(L*W*H): " + dimension, textFont);
            PdfPCell wtCell = new PdfPCell();
            wtCell.AddElement(wtPa);
            wtCell.Border = Rectangle.NO_BORDER;
            wtCell.PaddingLeft = 30f;
            headerTbl.AddCell(wtCell);

            // for one line space after total weight

            PdfPCell blankCell3 = new PdfPCell();
            blankCell3.Colspan = 2;
            blankCell3.Border = Rectangle.NO_BORDER;
            // blankCell3.BackgroundColor = cellBackColor;
            headerTbl.AddCell(blankCell3);

            // for last row with logo

            Paragraph senderPa = new Paragraph("Sender Name: " + basicPackageInfo.SenderName + "" + Environment.NewLine
             + "Servce Type: " + basicPackageInfo.ServiceType, textFont);
            PdfPCell senderCell = new PdfPCell(senderPa);
            senderCell.Border = Rectangle.NO_BORDER + Rectangle.RIGHT_BORDER;
            headerTbl.AddCell(senderCell);

            StoreSettingConfig ssc = new StoreSettingConfig();
            string storeLogoUrl = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, aspxCommonObj.StoreID,
                                                            aspxCommonObj.PortalID, aspxCommonObj.CultureName);
            string logoPath = HttpContext.Current.Request.MapPath("~/" + storeLogoUrl);
            PdfPTable logoTable = new PdfPTable(1);
            if (File.Exists(logoPath))
            {
                iTextSharp.text.Image logo =
                                   iTextSharp.text.Image.GetInstance(logoPath.Replace("uploads", "uploads/Small").Replace("\\", @"//"));
                logo.ScalePercent(50f);
                PdfPCell logoImage = new PdfPCell(logo);
                logoImage.Border = Rectangle.NO_BORDER;
                logoImage.PaddingLeft = 30f;
                logoImage.AddElement(logo);
                //PdfPTable logoTable = new PdfPTable(1);
                logoTable.WidthPercentage = 100;
                logoTable.AddCell(logoImage);
            }
            var storeName = ssc.GetStoreSettingsByKey(StoreSetting.StoreName, aspxCommonObj.StoreID,
                                                      aspxCommonObj.PortalID, aspxCommonObj.CultureName);
            PdfPCell storeNameCell = new PdfPCell(new Paragraph(storeName, textFont));
            storeNameCell.Border = Rectangle.NO_BORDER;
            storeNameCell.PaddingLeft = 30f;
            logoTable.AddCell(storeNameCell);

            PdfPCell logoCell = new PdfPCell();
            logoCell.AddElement(logoTable);
            logoCell.HorizontalAlignment = Element.ALIGN_CENTER;
            logoCell.Border = Rectangle.NO_BORDER;
            headerTbl.AddCell(logoCell);

            headerTbl.DefaultCell.Border = Rectangle.NO_BORDER;
            PdfPCell detailCell = new PdfPCell();
            detailCell.Colspan = 2;
            detailCell.AddElement(headerTbl);
            shipmentTalbe.AddCell(detailCell);
            doc.Add(shipmentTalbe);
            doc.Close();

        }