Example #1
0
        public List <Chain.Model.MerchantSite> DataTableToList(DataTable dt)
        {
            List <Chain.Model.MerchantSite> modelList = new List <Chain.Model.MerchantSite>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.MerchantSite model = new Chain.Model.MerchantSite();
                    if (dt.Rows[i]["MerchantID"] != null && dt.Rows[i]["MerchantID"].ToString() != "")
                    {
                        model.MerchantID = int.Parse(dt.Rows[i]["MerchantID"].ToString());
                    }
                    if (dt.Rows[i]["MerchantDesc"] != null && dt.Rows[i]["MerchantDesc"].ToString() != "")
                    {
                        model.MerchantDesc = dt.Rows[i]["MerchantDesc"].ToString();
                    }
                    if (dt.Rows[i]["MerchantPhoto"] != null && dt.Rows[i]["MerchantPhoto"].ToString() != "")
                    {
                        model.MerchantPhoto = dt.Rows[i]["MerchantPhoto"].ToString();
                    }
                    if (dt.Rows[i]["MerchantRemark"] != null && dt.Rows[i]["MerchantRemark"].ToString() != "")
                    {
                        model.MerchantRemark = dt.Rows[i]["MerchantRemark"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
        private void DrawImage(int MerchantID)
        {
            Chain.BLL.MerchantSite   MerchantSiteBll   = new Chain.BLL.MerchantSite();
            Chain.Model.MerchantSite MerchantSiteModel = MerchantSiteBll.GetModel(MerchantID);
            string imagePath = this.currentContext.Server.MapPath(MerchantSiteModel.MerchantPhoto);

            using (Bitmap smallImage = new Bitmap(imagePath))
            {
                Graphics g = Graphics.FromImage(smallImage);
                this.currentContext.Response.ContentType = "image/jpeg";
                smallImage.Save(this.currentContext.Response.OutputStream, ImageFormat.Jpeg);
            }
        }
Example #3
0
 public bool Update(Chain.Model.MerchantSite model)
 {
     return(this.dal.Update(model));
 }
Example #4
0
 public int Add(Chain.Model.MerchantSite model)
 {
     return(this.dal.Add(model));
 }