public bool deactiveIdxInfo(IdxInfoModels model, string userCode) { model.infoStatus = Constants.Status.Inactive; model.updatedDate = DateTime.Now; model.updatedBy = userCode; mapper.Update("Idx.updateIdxInfo", model); model.infoMessage = PsMModel.Resource.MsgSuccess; return true; }
public ActionResult Delete(string infoCode) { // TODO: Add delete logic here SysUserModels userSession = (SysUserModels)Session["UserSession"]; IdxInfoDAO infoDAO = new IdxInfoDAO(this.mapper); IdxInfoModels model = new IdxInfoModels(); model.infoCode = infoCode; infoDAO.deactiveIdxInfo(model, userSession.userCode); return RedirectToAction("Index"); }
public bool uploadIdxInfoFile(IdxInfoUploadModels model, string userCode, string uploadFolder) { string fileUrl = string.Empty; string fileName = string.Empty; IdxInfoModels data = new IdxInfoModels(); if (model.infoFile != null) { fileName = DateTime.Now.ToString("yyMMddHHmmssfff") + model.infoFile.FileName; //string fileName = "~/Content/UploadFiles/Index/" + DateTime.Now.ToString("yyMMddHHmmssfff") + indexFileUpload.indexFile.FileName; //string filePath = Path.Combine(uploadFolder, fileName); //model.infoFile.SaveAs(filePath); data.fileContent = new byte[model.infoFile.InputStream.Length]; long bytesRead = model.infoFile.InputStream.Read(data.fileContent, 0, (int)model.infoFile.InputStream.Length); model.infoFile.InputStream.Close(); } else { model.errorMessage = String.Format(PsMModel.Resource.MsgRequired, PsMModel.Resource.InfoFile); return false; } fileUrl = Path.Combine(Constants.File.UploadInfoFolder, fileName); data.infoCode = Utils.UtilsDAO.GenerateCode(Constants.CodePrefix.IdxInfo); data.infoTypeCode = model.infoTypeCode; data.fileUrl = fileUrl; data.fileName = model.infoFile.FileName; data.infoStatus = Constants.Status.Active; data.postedDate = DateTime.ParseExact(model.postedDate, Constants.DateTimeFormat, null); data.createdDate = DateTime.Now; data.createdBy = userCode; data.updatedDate = DateTime.Now; data.updatedBy = userCode; mapper.Insert("Idx.insertIdxInfo", data); model.infoMessage = PsMModel.Resource.MsgSuccess; return true; }