Ejemplo n.º 1
0
 public void fillDataFromDataRow(store obj, DataRow DR)
 {
     int i = 0; foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(obj))
     {
         if (i >= 0 && i < obj.maxSqlFields)
         {
             if (prop.PropertyType.ToString().ToLower().Contains("int"))
             {
                 prop.SetValue(obj, convertUtilities.stringToInt(DR[prop.Name].ToString()));
             }
             if (prop.PropertyType.ToString().ToLower().Contains("string"))
             {
                 prop.SetValue(obj, DR[prop.Name].ToString());
             }
             if (prop.PropertyType.ToString().ToLower().Contains("decimal"))
             {
                 prop.SetValue(obj, convertUtilities.stringToDecimal(DR[prop.Name].ToString()));
             }
             if (prop.PropertyType.ToString().ToLower().Contains("date"))
             {
                 prop.SetValue(obj, convertUtilities.stringToDate(DR[prop.Name].ToString()));
             }
             if (prop.PropertyType.ToString().ToLower().Contains("bool"))
             {
                 prop.SetValue(obj, convertUtilities.stringToBool(DR[prop.Name].ToString()));
             }
         }
         i++;
     }
 }
Ejemplo n.º 2
0
 private void getFormat(store obj)
 {
     string rtnTemplate = ""; for (int i = 0; i < obj.varItems.Length / 2; i++)
     {
         obj.varItems[i, 0] = genFunctions.getItemFormat(obj.varItems[i, 1], obj.template, out rtnTemplate); obj.template = rtnTemplate;
     }
 }
Ejemplo n.º 3
0
 public void resetValues(store obj)
 {
     int i = 0; foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(obj))
     {
         if (i >= 0 && i < obj.maxSqlFields)
         {
             if (prop.PropertyType.ToString().ToLower().Contains("int"))
             {
                 prop.SetValue(obj, 0);
             }
             if (prop.PropertyType.ToString().ToLower().Contains("string"))
             {
                 prop.SetValue(obj, "");
             }
             if (prop.PropertyType.ToString().ToLower().Contains("decimal"))
             {
                 prop.SetValue(obj, Convert.ToDecimal(0));
             }
             if (prop.PropertyType.ToString().ToLower().Contains("date"))
             {
                 prop.SetValue(obj, DateTime.Today);
             }
             if (prop.PropertyType.ToString().ToLower().Contains("bool"))
             {
                 prop.SetValue(obj, true);
             }
         }
         i++;
     }
 }
Ejemplo n.º 4
0
        private string getStoreAlbum(store obj)
        {
            string rtnStr = "";

            rtnStr += "<div class=\"col-xs-12 noPadding tm20\">";
            DataTable tblAlbum = obj.megaDataSet.Tables["tblAlbum"];

            if (tblAlbum.Rows.Count > 0)
            {
                DataRow DR;
                string  allAlbums = "";
                for (int i = 0; i < tblAlbum.Rows.Count; i++)
                {
                    DR         = tblAlbum.Rows[i];
                    allAlbums += DR["albumID"].ToString() + ",";
                    if ((i == 0 || i == 1) || (i == 2 && tblAlbum.Rows.Count == 3))
                    {
                        rtnStr += "<div class=\"col-xs-4 noPadding\"><div class=\"col-xs-12 albumImg\"><img src=\"/getThumb.aspx?width=225&img=img/cImg/" + DR["thumb"].ToString() + "\" alt=\"\" class=\"darkBorderAll\" /></div><div class=\"col-xs-12 text-center\" style=\"border:1px solid #f1f1f1;\"><a href=\"javascript:void(0);\" onclick = \"getAlbum(" + DR["albumID"].ToString() + ")\">" + DR["albumName"].ToString() + "</a></div></div>";
                    }

                    if (tblAlbum.Rows.Count > 3 && i == 2)
                    {
                        rtnStr += "<div class=\"col-xs-4 albumImg\"><div class=\"col-xs-12 moreAlbum\"><a href=\"javascript:void(0);\" onclick = \"getAlbums('[allAlbums]')\">View All<br />Albums</a></div></div>";
                    }
                }
                rtnStr = rtnStr.Replace("[allAlbums]", allAlbums);
            }
            else
            {
                rtnStr += "<div class=\"col-xs-4 albumImg\"><div class=\"col-xs-12 moreAlbum\">No albums added by store</div></div>";
            }
            rtnStr += "</div>";
            return(rtnStr);
        }
Ejemplo n.º 5
0
 public void getData(store obj)
 {
     getDS(obj); if (obj.sysErr == "")
     {
         printData(obj);
     }
 }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            store obj = new store(); obj.resetValues(obj);

            obj.varItems = new string[, ] {
                { "", "[megaItem]" }
            };                                                     //[0, 0] [0, 1]
            obj.template = albumTemplate.InnerHtml;
            obj.getImagesFromAlbum(obj);
            albumTemplate.InnerHtml = obj.outPut;
        }
Ejemplo n.º 7
0
        private string getStoreSQL(store obj)
        {
            string rtnStr = "";

            rtnStr  = "SELECT TOP 1 *";
            rtnStr += " , userSub=(SELECT count(*) from bw_post_subscribe WHERE storeID=" + obj.storeID.ToString() + " AND uID=" + postUtilities.getIntFrmSession("userID").ToString() + ")";
            rtnStr += " , storeCategoryList = STUFF((SELECT ', ' + cName FROM bw_store_cat WHERE cID IN (SELECT cID FROM bw_store_cat_rel WHERE storeID=S.storeID) FOR XML PATH(''), TYPE).value('.[1]', 'nvarchar(max)'), 1, 1, '')";
            rtnStr += " FROM " + cPreFix + "store S";
            rtnStr += " LEFT OUTER JOIN " + cPreFix + "user_country C ON C.countryID = S.storeCountry";
            rtnStr += " WHERE storeID=" + obj.storeID.ToString();
            //HttpContext.Current.Response.Write(rtnStr);
            return(rtnStr);
        }
Ejemplo n.º 8
0
        private string getPayMethodList(store obj)
        {
            string    rtnStr = "";
            DataTable DT     = obj.megaDataSet.Tables["tblPayMethod"];

            for (int i = 0; i < DT.Rows.Count; i++)
            {
                if (i > 0)
                {
                    rtnStr += ", ";
                }
                rtnStr += DT.Rows[i]["paymentMethName"].ToString();
            }
            return(rtnStr);
        }
Ejemplo n.º 9
0
        private string getAlbumImageList(store obj)
        {
            string    rtnStr = "", itemStr = ""; DataRow DR; string[,] objVars;
            DataTable DT = obj.megaDataSet.Tables["tblImages"];

            for (int i = 0; i < DT.Rows.Count; i++)
            {
                DR      = DT.Rows[i];
                objVars = new string[, ] {
                    { "[imgName]", DR["imgName"].ToString() }
                };
                itemStr = genFunctions.replaceVars(objVars, obj.varItems[obj.varTopIndex, 0]);
                rtnStr += itemStr;
            }
            return(rtnStr);
        }
Ejemplo n.º 10
0
 public void assignArray(store obj)
 {
     obj.fieldsArray = new string[obj.maxSqlFields, 3]; int i = 0; foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(obj))
     {
         if (i >= 0 && i < obj.maxSqlFields)
         {
             obj.fieldsArray[i, 0] = obj.sqlID.ToString(); obj.fieldsArray[i, 1] = prop.Name; if (prop.PropertyType.ToString().ToLower().Contains("int") || prop.PropertyType.ToString().ToLower().Contains("string") || prop.PropertyType.ToString().ToLower().Contains("date") || prop.PropertyType.ToString().ToLower().Contains("bool"))
             {
                 obj.fieldsArray[i, 2] = prop.GetValue(obj).ToString();
             }
             if (prop.PropertyType.ToString().ToLower().Contains("decimal"))
             {
                 obj.fieldsArray[i, 2] = ((Decimal)prop.GetValue(obj)).ToString("0.00");
             }
         }
         i++;
     }
 }
Ejemplo n.º 11
0
        internal void getDS(store obj)
        {
            int i = -1, j = -1, arrayLength = 3, paramLength = 0; sqlConnectivity sql = new sqlConnectivity(); sql.inputSQL = new string[arrayLength, 4]; sql.inputParams = new string[paramLength, 3];

            i++; sql.inputSQL[i, 0] = i.ToString(); sql.inputSQL[i, 2] = "SQL"; sql.inputSQL[i, 3] = "tblStore"; sql.inputSQL[i, 1] = getStoreSQL(obj);
            i++; sql.inputSQL[i, 0] = i.ToString(); sql.inputSQL[i, 2] = "SQL"; sql.inputSQL[i, 3] = "tblAlbum"; sql.inputSQL[i, 1] = "SELECT TOP 4 *, thumb =(SELECT TOP 1 imgName from bw_user_img WHERE albumID=A.albumID) FROM bw_user_img_album A WHERE uID=(SELECT TOP 1 uID FROM bw_store WHERE storeID=" + storeID.ToString() + ")";
            i++; sql.inputSQL[i, 0] = i.ToString(); sql.inputSQL[i, 2] = "SQL"; sql.inputSQL[i, 3] = "tblPayMethod"; sql.inputSQL[i, 1] = "SELECT * FROM bw_storePayMeth A LEFT OUTER JOIN bw_paymentMethod B ON A.paymentMethID=B.paymentMethID WHERE storeID=" + storeID.ToString();
            sql.getData();
            //HttpContext.Current.Response.Write(sql.inputSQL[i, 1]); HttpContext.Current.Response.End();
            if (sql.sysErr == "")
            {
                obj.megaDataSet = sql.megaDataSet;
            }
            else
            {
                obj.sysErr = sql.sysErr;
            }
        }
Ejemplo n.º 12
0
 private void getPage()
 {
     if (storeID > 0)
     {
         store obj = new store(); obj.storeID = storeID; obj.template = storeDetails.InnerHtml; obj.getData(obj);
         if (obj.megaDataSet.Tables["tblStore"].Rows.Count > 0)
         {
             storeDetails.InnerHtml = obj.outPut;
         }
         else
         {
             storeDetails.InnerHtml = "<div style=\"padding:300px 0 400px 0; text-align:center; font-size:18px;\">No Store Information Found</div>";
         } divSysErr.InnerHtml = obj.sysErr;
         //storeMsgBtn.InnerHtml =
     }
     else
     {
         Response.Redirect("/");
     }
 }
Ejemplo n.º 13
0
        public void printData(store obj)
        {
            //if (obj.template == "") obj.template = obj.megaDataSet.Tables["tblTemplate"].Rows[0][0].ToString();
            getFormat(obj);

            if (obj.megaDataSet.Tables["tblStore"].Rows.Count > 0)
            {
                DataRow DR = obj.megaDataSet.Tables["tblStore"].Rows[0];
                string[,] objVars = new string[, ] {
                    { "[storeID]", DR["storeID"].ToString() },
                    { "[storeName]", DR["storeName"].ToString() },
                    { "[storeLogo]", DR["storeLogo"].ToString() },
                    { "[storeTagLine]", DR["storeTagLine"].ToString() },
                    { "[storeSmDesc]", DR["storeSmDesc"].ToString() },
                    { "[megaRating]", getRating() },
                    { "[storeCategoryList]", DR["storeCategoryList"].ToString() },
                    { "[storeAddress]", getStoreAddress(DR) },
                    { "[storePhone1]", DR["storePhone1"].ToString() },
                    { "[storePhone2]", ((DR["storePhone2"].ToString() == "")?"":", " + DR["storePhone2"].ToString()) },
                    { "[paymentMethodList]", getPayMethodList(obj) },
                    { "[storeWebsite]", DR["storeWebsite"].ToString() },
                    { "[parkingFacilityAvailable]", (DR["parkingFacilityAvailable"].ToString().ToLower() == "true") ? "Yes" : "No" },
                    { "[parkingInfo]", DR["parkingInfo"].ToString() },
                    { "[storeMenu]", DR["storeMenu"].ToString() },
                    { "[lastUpdated]", convertUtilities.stringToDate(DR["lastUpdated"].ToString()).ToString("dd/MM/yyyy") },
                    { "[storeAlbum]", getStoreAlbum(obj) },
                    { "[storeOpenDays]", getStoreOpenDays(DR) },
                    { "[storeCity]", DR["storeCity"].ToString() },
                    { "[storeState]", DR["storeState"].ToString() },
                    { "[storeTagLine]", DR["storeTagLine"].ToString() },
                    { "[subscribeLink]", getSubscribeLink(storeID, Convert.ToInt32(DR["userSub"])) },
                    { "[storeMsgBtn]", genFunc.getLoginMsg("storeMsg", "jazTipSubscribe", DR["storeEmail"].ToString(), "0", "0", 0) },
                    { "[storeTagLine]", DR["storeTagLine"].ToString() }
                };
                obj.outPut = genFunctions.replaceVars(objVars, obj.template);
            }
        }
Ejemplo n.º 14
0
        internal void getImagesFromAlbum(store obj)
        {
            getFormat(obj);
            int i = -1, j = -1, arrayLength = 1, paramLength = 0; sqlConnectivity sql = new sqlConnectivity(); sql.inputSQL = new string[arrayLength, 4]; sql.inputParams = new string[paramLength, 3];

            i++; sql.inputSQL[i, 0] = i.ToString(); sql.inputSQL[i, 2] = "SQL"; sql.inputSQL[i, 3] = "tblImages"; sql.inputSQL[i, 1] = "select * from bw_user_img I LEFT OUTER JOIN bw_user_img_album a on A.albumID=I.albumID WHERE I.albumID=" + postUtilities.getIntFrmQString("albumid");
            //HttpContext.Current.Response.Write(sql.inputSQL[i, 1]);
            sql.getData(); if (sql.sysErr == "")
            {
                obj.megaDataSet = sql.megaDataSet; obj.varTopIndex = (obj.varItems.Length / 2) - 1;
                if (obj.megaDataSet.Tables["tblImages"].Rows.Count > 0)
                {
                    obj.outPut = obj.template.Replace("[albumName]", obj.megaDataSet.Tables["tblImages"].Rows[0]["albumName"].ToString()).Replace(obj.varItems[obj.varTopIndex, 1], getAlbumImageList(obj));
                }
                else
                {
                    obj.outPut = "";
                }
            }
            else
            {
                obj.sysErr = sql.sysErr;
            }
        }