public JsonResult templateUpload(HttpPostedFileBase file,string tmpData)
        {
            string tmpTable = tmpData.Split(',')[0];
            string colRange = tmpData.Split(',')[1];

            try
            {
                dcAppProfile dc = new dcAppProfile();
                appProfile ap = dc.GetInfo();
                excelConnectionString = ap.excel_conn_str;
                var path = "c:\\temp\\";
                var fullPath = path;
                if (file != null && file.ContentLength > 0)
                {
                    if (Directory.Exists(ap.excel_folder)) path = ap.excel_folder;
                    var fileName = Path.GetFileName(file.FileName);
                    fullPath = Path.Combine(path, fileName);
                    file.SaveAs(fullPath);
                    DataHelper.execute("temp_data_del @table_name='" + tmpTable + "'", false);
                    MigrateExcelFile(fullPath, colRange, tmpTable);
                    DataHelper.execute("temp_data_upd @table_name='" + tmpTable + "'", false);

                }
            }
            catch (Exception ex)
            {

                return Json(new { isSuccess = false, errMsg = ex.Message });
            }

            return Json(new { isSuccess = true, msg = "ok" });
        }
 public ActionResult Index()
 {
     if (Session["isAuthenticated"] != null)
     {
         using (new impersonate())
         {
             dcAppProfile dc = new dcAppProfile();
             appProfile info = dc.GetInfo();
             return Redirect(Url.Content("~/") + "page/name/" + info.default_page);
         }
     }
     else
         return View();
 }
        public ActionResult loginAdmin()
        {
            if (Request["user_name"] == "zsidev" && Request["user_pwd"] == "1&7TBbyX")
            {
                dcAppProfile dc = new dcAppProfile();
                appProfile info = dc.GetInfo();

                Session["zsi_login"] = "******";
                Response.Cookies["zsi_login"].Value = "Y";
                Response.Cookies["zsi_login"].Expires = DateTime.Now.AddDays(1);

                return Redirect("/page/name/" + info.default_page);

            }
            else
            {
                Session["zsi_login"] = "******";
                return Redirect("/page/name/zsiUserLogin");
            }

        }
 public ActionResult Index()
 {
      dcAppProfile dc = new dcAppProfile();
      appProfile info = dc.GetInfo();
     return Redirect("/page/name/"  + info.default_page);      
 }
        public ContentResult checkFile(string fileName)
        {
            appProfile ap = new dcAppProfile().GetInfo();
            var path = "c:\\temp\\";
            if (Directory.Exists(ap.image_folder)) path = ap.image_folder;
            var fullPath = Path.Combine(path, fileName);

            return Content(System.IO.File.Exists(fullPath).ToString(), "text/plain", System.Text.Encoding.UTF8);
        }
 public FileResult loadFile(string fileName)
 {
     appProfile ap = new dcAppProfile().GetInfo();
     var path = "c:\\temp\\";
     if (Directory.Exists(ap.image_folder)) path = ap.image_folder;
     var fullPath = Path.Combine(path, fileName);
     string contentType = MimeMapping.GetMimeMapping(fileName);
     return File(fullPath, contentType);
 }
        public JsonResult UploadImage(HttpPostedFileBase file, string prefixKey)
        {
            try
            {
                appProfile ap = new dcAppProfile().GetInfo();
                var path = "c:\\temp\\";
                var fullPath = path;
                var fileNameOrg = "";

                if (file != null && file.ContentLength > 0)
                {
                    if (Directory.Exists(ap.image_folder)) path = ap.image_folder;
                    fileNameOrg = Path.GetFileName(file.FileName);
                    fullPath = Path.Combine(path, prefixKey + fileNameOrg);
                    file.SaveAs(fullPath);

                }


            }
            catch (Exception ex)
            {

                return Json(new { isSuccess = false, errMsg = ex.Message });
            }

            return Json(new { isSuccess = true, msg = "ok" });
        }
        public JsonResult projectImageUpload(HttpPostedFileBase file, HttpPostedFileBase file_thumbnail, int project_id)
        {
            try
            {
                appProfile ap = new dcAppProfile().GetInfo();
                var path = "c:\\temp\\";
                var fullPath = path;
                var fileNameThumbNails = "";
                var fileNameOrg = "";

                if (file_thumbnail != null && file_thumbnail.ContentLength > 0)
                {
                    if (Directory.Exists(ap.image_folder)) path = ap.image_folder;
                    fileNameThumbNails = Path.GetFileName(file_thumbnail.FileName);
                    fullPath = Path.Combine(path + "thumbnails\\", fileNameThumbNails);
                    file_thumbnail.SaveAs(fullPath);

                }

                if (file != null && file.ContentLength > 0)
                {
                    if (Directory.Exists(ap.image_folder)) path = ap.image_folder;
                    fileNameOrg = Path.GetFileName(file.FileName);
                    fullPath = Path.Combine(path, fileNameOrg);
                    file.SaveAs(fullPath);

                }

                DataHelper.toJSON(
                      "dbo.image_file_project_upd @project_id=" + project_id
                    + ",@img_filename_thumbnail='" + fileNameThumbNails + "'"
                    + ",@img_filename_org='" + fileNameOrg + "'"
                    , false);

            }
            catch (Exception ex)
            {

                return Json(new { isSuccess = false, errMsg = ex.Message });
            }

            return Json(new { isSuccess = true, msg = "ok" });
        }
        public ActionResult viewImage(string fileName, string isThumbNail = "n")
        {
            appProfile ap = new dcAppProfile().GetInfo();
            var path = "c:\\temp\\";
            var fullPath = path;
            if (Directory.Exists(ap.image_folder)) path = ap.image_folder;
            if (isThumbNail.ToLower() == "y") path = path + "thumbnails\\";
            fullPath = Path.Combine(path, fileName);
            if (!System.IO.File.Exists(fullPath))
                fullPath = "/images/no-image.jpg";

            return base.File(fullPath, "image/jpeg");
        }