コード例 #1
0
 public DataSet Save_Institute_Video_Gallery(mInstituteGallery _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("sp_Insert_Update_Institute_Video_Gallery", _cn);
         _cmd.Parameters.AddWithValue("@ID", _obj.ID);
         _cmd.Parameters.AddWithValue("@InstituteID", _obj.InstituteID);
         _cmd.Parameters.AddWithValue("@CategoryID", _obj.CategoryID);
         _cmd.Parameters.AddWithValue("@VideoURL", _obj.VideoURL);
         _cmd.Parameters.AddWithValue("@Description", _obj.Description);
         _cmd.Parameters.AddWithValue("@CreatedIP", _obj.CreatedIP);
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
コード例 #2
0
        public JsonResult Select_Institute_Photo_Gallery(string ID = "")
        {
            List <mInstituteGallery>   _list          = new List <mInstituteGallery>();
            InstituteGalleryRepository _objRepository = new InstituteGalleryRepository();

            // using (IInstituteGallery _objRepository = new RInstituteGallery())
            {
                DataSet ds = _objRepository.Select_Institute_Photo_Gallery(ID, Session["InstituteID"].ToString());
                if (ds != null)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            mInstituteGallery _objList = new mInstituteGallery();
                            _objList.ID           = row["ID"].ToString();
                            _objList.InstituteID  = row["InstituteID"].ToString();
                            _objList.ImagePath    = row["ImagePath"].ToString();
                            _objList.Description  = row["Description"].ToString();
                            _objList.CategoryID   = row["CategoryID"].ToString();
                            _objList.CategoryName = row["GallaryCategory_Name"].ToString();
                            _list.Add(_objList);
                        }
                    }
                }
            }

            return(Json(new
            {
                List = _list
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
コード例 #3
0
        public JsonResult Save_Institute_Video_Gallery(mInstituteGallery _obj)
        {
            bool flag = false;
            InstituteGalleryRepository _objRepository = new InstituteGalleryRepository();

            // using (IInstituteGallery _objRepository = new RInstituteGallery())
            {
                string localIP = "?";
                localIP          = Request.ServerVariables["REMOTE_ADDR"].ToString();
                _obj.CreatedIP   = localIP;
                _obj.InstituteID = Session["InstituteID"].ToString();
                _obj.Edited_by   = Session["User_id"].ToString();
                DataSet _ds = _objRepository.Save_Institute_Video_Gallery(_obj);
                if (_ds != null)
                {
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        if (_ds.Tables[0].Rows[0]["FLAG"].ToString() == "1")
                        {
                            flag = true;
                        }
                    }
                }
            }

            return(Json(new
            {
                flag = flag
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
コード例 #4
0
        public JsonResult Save_Institute_Photo_Gallery(mInstituteGallery _obj)
        {
            string path     = "";
            string filename = "";
            string fname    = "";

            if (Request.Files.Count > 0)
            {
                if (Request.Files[0].ContentLength > 0)
                {
                    HttpFileCollectionBase files = Request.Files;
                    path     = AppDomain.CurrentDomain.BaseDirectory + "Uploads/Institute/" + Session["InstituteID"].ToString() + "/Gallery/Photo/";
                    filename = Path.GetFileName(Request.Files[0].FileName);
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    else
                    {
                        string[] curentfiles = Directory.GetFiles(path);
                    }
                    HttpPostedFileBase file = files[0];
                    filename = Session["InstituteID"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(file.FileName);
                    fname    = Path.Combine(Server.MapPath("~/Uploads/Institute/" + Session["InstituteID"].ToString() + "/Gallery/Photo/"), filename);
                    file.SaveAs(fname);
                    _obj.ImagePath = "Uploads/Institute/" + Session["InstituteID"].ToString() + "/Gallery/Photo/" + filename;
                }
                else
                {
                    _obj.ImagePath = "";
                }
            }
            else
            {
                _obj.ImagePath = "";
            }
            bool flag = false;
            InstituteGalleryRepository _objRepository = new InstituteGalleryRepository();

            // using (IInstituteGallery _objRepository = new RInstituteGallery())
            {
                string localIP = "?";
                localIP          = Request.ServerVariables["REMOTE_ADDR"].ToString();
                _obj.CreatedIP   = localIP;
                _obj.InstituteID = Session["InstituteID"].ToString();
                _obj.Edited_by   = Session["User_id"].ToString();
                DataSet _ds = _objRepository.Save_Institute_Photo_Gallery(_obj);
                if (_ds != null)
                {
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        if (_ds.Tables[0].Rows[0]["FLAG"].ToString() == "1")
                        {
                            flag = true;
                        }
                    }
                }
            }

            return(Json(new
            {
                flag = flag
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }