private void InitData() { if (DocumentId != "") { BDocument ctl = new BDocument(); if (ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D"))) != null) { ODocument obj = ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D")))[0]; if (obj != null) { txtName.Text = obj.Name; txtContent.Text = obj.Content; txtEndDate.Text = obj.EndProcess.ToString("dd/MM/yyyy"); txtStartDate.Text = obj.StartProcess.ToString("dd/MM/yyyy"); txtSubContent.Text = obj.Excerpt; //lblLink.Text = obj.Attachs; try { ddlLevel.Items.FindByValue(obj.Priority).Selected = true; } catch (Exception ex) { } try { ddlOffical.Items.FindByValue(obj.PublishOffical.ToString()).Selected = true; } catch (Exception ex) { } try { ddlType.Items.FindByValue(obj.IDDocumentKind.ToString()).Selected = true; } catch (Exception ex) { } BindUserProcess(obj.UserProcess); rptFiles.DataSource = (new BAttach()).GetAttachs(obj.Attachs); rptFiles.DataBind(); if (obj.Attachs == "" || obj.Attachs == ",") { lblThongBao.Text = "Không có file đính kèm!"; } } } } }
private void InitData() { if (DocumentId != "") { BDocument ctl = new BDocument(); if (ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentDrap.ToString("D"))) != null) { ODocument obj = ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentDrap.ToString("D")))[0]; if (obj != null) { lblName.Text = obj.Name; lblSubContent.Text = obj.Excerpt; lblUserDrap.Text = obj.IDUserCreate.ToString(); try { lblUserDrap.Text = (new BUser()).Get(obj.IDUserCreate).First().UserName; } catch (Exception ex) { } lblAttach.Text = obj.Attachs; BComment BobjComment = new BComment(); rptComment.DataSource = BobjComment.Get("", DocumentId, 0); rptComment.DataBind(); List <OAttach> listAttach = new List <OAttach>(); foreach (OComment objI in BobjComment.Get("", DocumentId, 0)) { listAttach = listAttach.Union(BobjComment.GetAttachs(objI.CommentID)).ToList(); } rptFileAttachs.DataSource = listAttach; rptFileAttachs.DataBind(); } } } }
/// <summary> /// Bind dannh sách văn bản /// </summary> private void BindData() { DateTime StartDate = DateTime.ParseExact("01/01/1970", "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); DateTime EndDate = DateTime.MaxValue; if (txtStartDate.Text.Trim().Length > 0) { StartDate = DateTime.ParseExact(txtStartDate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); } if (txtEndDate.Text.Trim().Length > 0) { EndDate = DateTime.ParseExact(txtEndDate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); } int pagesize = int.Parse(ddlPageSize.SelectedValue); BDocument ctl = new BDocument(); IList <ODocument> lst = ctl.Get("", txtKey.Text, StartDate, EndDate, int.Parse(Common.DocumentType.DocumentDrap.ToString("D")), 0, "", int.Parse(EOFFICE.Common.DocumentStatus.Processed.ToString("D")), "Name", "DESC", 0, int.Parse(hdfCurrentPage.Value), pagesize, int.Parse(EOFFICE.Common.DocumentType.DocumentDrap.ToString("D"))); grvListDocument.DataSource = lst; grvListDocument.DataBind(); if (grvListDocument.Rows.Count > 0) { if (lst[0].TotalResult > pagesize) { ctlPagging.Visible = true; ctlPagging.PageSize = int.Parse(ddlPageSize.SelectedValue); ctlPagging.CurrentIndex = int.Parse(hdfCurrentPage.Value); ctlPagging.ItemCount = lst[0].TotalResult; ctlPagging.QueryStringParameterName = GenarateParam(); } else { ctlPagging.Visible = false; } } }
/// <summary> /// Gửi bản thảo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkSendDrap_Click(object sender, EventArgs e) { ODocument obj; BDocument ctl = new BDocument(); if (DocumentId != "") { try { obj = ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D")))[0]; if (obj != null) { string listFile = ","; try { obj = ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D")))[0]; if (obj != null) { ctl.UpdatePublish(DocumentId, "", EOFFICE.Common.DocumentStatus.Published.ToString("D"), DateTime.Now.ToString("MM/dd/yyyy")); Response.Redirect("/DocumentSend/DocumentProcess.aspx"); } } catch (Exception ex) { } } } catch (Exception ex) { } } else { } }
/// <summary> /// Sự kiện xảy ra khi thực hiện các thao tác trên danh sách Công văn đến /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grvListDocument_RowCommand(object sender, GridViewCommandEventArgs e) { //-- Sửa Công văn đến if (e.CommandName.Equals("cmdEdit", StringComparison.OrdinalIgnoreCase)) { //-- Chuyển tới trang sửa Công văn đến Response.Redirect("/DocumentSend/DocumentEdit.aspx?DocumentId=" + e.CommandArgument.ToString()); } //--Xóa Công văn đến else if (e.CommandName.Equals("cmdDelete", StringComparison.OrdinalIgnoreCase)) { BDocument ctl = new BDocument(); try { //-- THực hiện xóa Công văn đến ctl.Delete(e.CommandArgument.ToString()); //--Load lại danh sách Công văn đến BindData(); } catch (Exception ex) { //--Load lại danh sách Công văn đến BindData(); } } //--Khóa Công văn đến else if (e.CommandName.Equals("cmdUnApprove", StringComparison.OrdinalIgnoreCase)) { BUser ctl = new BUser(); try { //-- THực hiện cập nhật trạng thái ctl.UpdateStatus(e.CommandArgument.ToString(), UserStatus.UnApprove.ToString("D")); //--Load lại danh sách Công văn đến BindData(); } catch (Exception ex) { //--Load lại danh sách Công văn đến BindData(); } } //--Duyệt Công văn đến else if (e.CommandName.Equals("cmdApprove", StringComparison.OrdinalIgnoreCase)) { BUser ctl = new BUser(); try { //-- THực hiện cập nhật trạng thái ctl.UpdateStatus(e.CommandArgument.ToString(), UserStatus.Approve.ToString("D")); //--Load lại danh sách Công văn đến BindData(); } catch (Exception ex) { //--Load lại danh sách Công văn đến BindData(); } } }
/// <summary> /// Bind dannh sách Công văn đến /// </summary> private void BindData() { BUser ctlUP = new BUser(); //-- Kiểm tra quyền dự thảo if (!ctlUP.HasPermission(Global.UserInfo.UserID, Common.PermissionCode.DocumentReceivedDrap.ToString()) && !Global.IsAdmin()) { Response.Redirect("/permission-fail.aspx"); } DateTime StartDate = DateTime.ParseExact("01/01/1970", "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); DateTime EndDate = DateTime.MaxValue; if (txtStartDate.Text.Trim().Length > 0) { StartDate = DateTime.ParseExact(txtStartDate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); } if (txtEndDate.Text.Trim().Length > 0) { EndDate = DateTime.ParseExact(txtEndDate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); } int pagesize = int.Parse(ddlPageSize.SelectedValue); BDocument ctl = new BDocument(); IList <ODocument> lst = ctl.Get("", txtKey.Text, StartDate, EndDate, int.Parse(ddlDocumentType.SelectedValue), 0, "", int.Parse(EOFFICE.Common.DocumentStatus.SendAgain.ToString("D")), "Name", "DESC", Global.UserInfo.UserID, int.Parse(hdfCurrentPage.Value), pagesize, int.Parse(EOFFICE.Common.DocumentType.DocumentReceived.ToString("D"))); grvListDocument.DataSource = lst; grvListDocument.DataBind(); if (grvListDocument.Rows.Count > 0) { if (lst[0].TotalResult > pagesize) { ctlPagging.Visible = true; ctlPagging.PageSize = int.Parse(ddlPageSize.SelectedValue); ctlPagging.CurrentIndex = int.Parse(hdfCurrentPage.Value); ctlPagging.ItemCount = lst[0].TotalResult; ctlPagging.QueryStringParameterName = GenarateParam(); } else { ctlPagging.Visible = false; } } //int count = ctl.GetCount(_fullname, _username, _email, _departmentid, _status, "", ""); //ctlPagging.PageSize = int.Parse(ddlPageSize.SelectedValue); //spResultCount.InnerHtml = "Tìm thấy <b>" + count.ToString() + "</b> kết quả"; //if (count > ctlPagging.PageSize) //{ // ctlPagging.Visible = true; //} //else //{ // ctlPagging.Visible = false; //} //grvListDocument.DataSource = ctl.Get(_fullname, _username, _email, _departmentid, _status, "DESC", "UserId", CurrentPage, ctlPagging.PageSize); //grvListDocument.DataBind(); //ctlPagging.CurrentIndex =CurrentPage; //ctlPagging.ItemCount = count; //ctlPagging.QueryStringParameterName = GenarateParam(); }
public Object Post([FromBody] TblDocuments document) { Payload payload = BAccount.ConfirmToken(this.Request); if (payload == null || (!payload.rol.Contains(2) && !payload.rol.Contains(3) && !payload.rol.Contains(6))) { return(new { result = false, info = "Não autorizado." }); } return(BDocument.CreateDocument(document, payload.aud)); }
public Object Delete(int documentid) { Payload payload = BAccount.ConfirmToken(this.Request); if (payload == null || (!payload.rol.Contains(2) && !payload.rol.Contains(3) && !payload.rol.Contains(6))) { return(new { result = false, info = "Não autorizado." }); } return(BDocument.DeleteDocument(documentid, payload.aud)); }
public void rptItemCommand(object sender, RepeaterCommandEventArgs e) { //Response.Write(e.CommandName); //Response.Write(e.CommandArgument); if (e.CommandName == "Download") { try { HttpContext.Current.Response.ContentType = "application/octet-stream"; HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName(e.CommandArgument.ToString())); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.WriteFile(e.CommandArgument.ToString()); HttpContext.Current.Response.End(); } catch (Exception ex) { throw ex; } } if (e.CommandName == "Delete") { OAttach objAttach = new OAttach(); BAttach BobjAttach = new BAttach(); BDocument Bdocument = new BDocument(); ODocument obj = Bdocument.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D"))).First(); //int IDUserCreate = int.Parse(objWork.IDUserCreate.ToString()); string listAttach = obj.Attachs.ToString(); objAttach = BobjAttach.Get(int.Parse(e.CommandArgument.ToString())).First(); string AttachId = objAttach.AttachID.ToString(); try { FileInfo TheFile = new FileInfo(Server.MapPath(objAttach.Path)); if (TheFile.Exists) { File.Delete(Server.MapPath(objAttach.Path)); //Xóa file Attach BobjAttach.Delete(objAttach.AttachID); //Xóa file Attach trong CSDL string newListAttach = listAttach.Replace("," + AttachId + ",", ","); obj.Attachs = newListAttach; Bdocument.Update(obj.DocumentID, "", obj.Name, obj.Excerpt, obj.Content, "", obj.PublishOffical, obj.Attachs, obj.IDDocumentKind, "", obj.UserProcess, "", obj.StartProcess.ToString("MM/dd/yyyy"), obj.EndProcess.ToString("MM/dd/yyyy"), DateTime.Now.ToString("MM/dd/yyyy"), "", obj.SendOfficals, obj.Priority, obj.Status); InitData(); } else { throw new FileNotFoundException(); } } catch (Exception ex) { //throw new FileNotFoundException(); } } }
public Object DocumentsbyUser(int userid) { Payload payload = BAccount.ConfirmToken(this.Request); if (payload == null || (!payload.rol.Contains(3) && !payload.rol.Contains(6) && !payload.rol.Contains(2) || (payload.rol.Contains(2) && payload.aud != userid))) { return(new { result = false, info = "Não autorizado." }); } return(BDocument.GetDocumentsbyUser(userid)); }
private void InitData() { //BUser ctlUP = new BUser(); ////-- Kiểm tra quyền dự thảo //if (ctlUP.HasPermission(Global.UserInfo.UserID, Common.PermissionCode.DocumentSendDrap.ToString())) // Response.Redirect("/"); BUser ctlUP = new BUser(); //-- Kiểm tra quyền dự thảo if (!ctlUP.HasPermission(Global.UserInfo.UserID, Common.PermissionCode.DocumentSendDrap.ToString()) && !Global.IsAdmin()) { Response.Redirect("/permission-fail.aspx"); } if (DocumentId != "") { BDocument ctl = new BDocument(); if (ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D"))) != null) { ODocument obj = ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D")))[0]; if (obj != null) { lblName.Text = obj.Name; lblSubContent.Text = obj.Excerpt; lblUserDrap.Text = obj.IDUserCreate.ToString(); try { lblUserDrap.Text = (new BUser()).Get(obj.IDUserCreate).First().UserName; } catch (Exception ex) { } //lblAttach.Text = obj.Attachs; BComment BobjComment = new BComment(); rptComment.DataSource = BobjComment.Get("", DocumentId, 0); rptComment.DataBind(); List <OAttach> listAttach = new List <OAttach>(); foreach (OComment objI in BobjComment.Get("", DocumentId, 0)) { listAttach = listAttach.Union(BobjComment.GetAttachs(objI.CommentID)).ToList(); } rptFileAttachs.DataSource = listAttach; rptFileAttachs.DataBind(); rptFiles.DataSource = (new BAttach()).GetAttachs(obj.Attachs); rptFiles.DataBind(); } } } }
public TeacherController(SIEContext context, IConfiguration configuration) { _bHistory = new BHistory(context); _bActivity = new BActivity(context); _bRoom = new BRoom(context); _bAnswer = new BAnswer(context); _bDocument = new BDocument(context); _bRelUploadActivity = new BRelUploadActivity(context); _uActivity = new UActivity(context); _uRoom = new URoom(context); _uAnswer = new UAnswer(context); _uRelUploadActivity = new URelUploadActivity(context); _uRelUploadAnswer = new URelUploadAnswer(context); _configuration = configuration; }
public Object DocumentsbyClass(int classid) { Payload payload = BAccount.ConfirmToken(this.Request); if (payload == null || payload.rol.Contains(4) || ((payload.rol.Contains(1) || payload.rol.Contains(5) || payload.rol.Contains(2)) && !payload.cla.Contains(classid))) { return(new { result = false, info = "Não autorizado." }); } if (payload.rol.Contains(1) || payload.rol.Contains(5)) { return(BDocument.GetDocumentsbyClassStudent(classid)); } else { return(BDocument.GetDocumentsbyClass(classid)); } }
protected void cmdDownAttachs_Click(object sender, EventArgs e) { try { string usn = ""; ODocument obj; BDocument ctl = new BDocument(); if (DocumentId != "") { try { obj = ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D")))[0]; if (obj != null) { BUser ctlU = new BUser(); OUser objU = ctlU.Get(obj.IDUserCreate)[0]; if (objU != null) { usn = objU.UserName; } } } catch (Exception ex) { } } else { } HttpContext.Current.Response.ContentType = "application/octet-stream"; HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName("DocumentFiles/" + usn + "/" + lblAttach.Text)); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.WriteFile("DocumentFiles/" + usn + "/" + lblAttach.Text); HttpContext.Current.Response.End(); } catch (Exception ex) { throw ex; } }
public StudentController(SIEContext context, IConfiguration configuration) { _context = context; _bHistory = new BHistory(context); _bRelStudentRoom = new BRelStudentRoom(context); _bRoom = new BRoom(context); _bAnswer = new BAnswer(context); _bDocument = new BDocument(context); _bRelUploadAnswer = new BRelUploadAnswer(context); _uActivity = new UActivity(context); _uRelStudentRoom = new URelStudentRoom(context); _uRoom = new URoom(context); _uAnswer = new UAnswer(context); _uRelUploadActivity = new URelUploadActivity(context); _uRelUploadAnswer = new URelUploadAnswer(context); _uPerson = new UPerson(context); _configuration = configuration; }
/// <summary> /// Gửi bản thảo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkSendDrap_Click(object sender, EventArgs e) { ODocument obj; BDocument ctl = new BDocument(); if (DocumentId != "") { try { obj = ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentReceived.ToString("D")))[0]; if (obj != null) { string listFile = ","; try { obj = ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentReceived.ToString("D")))[0]; try { if (FileUpload1.PostedFile == null) { return; } if (!Directory.Exists(Server.MapPath("DocumentFiles"))) { Directory.CreateDirectory(Server.MapPath("DocumentFiles")); } if (!Directory.Exists(Server.MapPath("DocumentFiles/" + Global.UserInfo.UserName))) { Directory.CreateDirectory(Server.MapPath("DocumentFiles/" + Global.UserInfo.UserName)); } BAttach Bobj = new BAttach(); HttpFileCollection hfc = Request.Files; int n = hfc.Count; if (n > 0) { try { // Get the HttpFileCollection for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { hpf.SaveAs(Server.MapPath("DocumentFiles/" + Global.UserInfo.UserName) + "/" + hpf.FileName); OAttach objA = new OAttach(); objA.Name = System.IO.Path.GetFileName(hpf.FileName); objA.Path = Server.MapPath("DocumentFiles/" + Global.UserInfo.UserName) + "/" + hpf.FileName; objA.Description = ""; Bobj.Add(objA); listFile += Bobj.GetLast().FirstOrDefault().AttachID.ToString() + ","; } } } catch (Exception ex) { } } //FileUpload1.SaveAs(Server.MapPath("DocumentFiles/" + Global.UserInfo.UserName + "/" + FileUpload1.FileName)); } catch (Exception ex) { } if (obj != null) { //Tạo Comment mới BComment BobjComment = new BComment(); OComment objComment = new OComment(); objComment.CommentID = DocumentId + DateTime.Now.ToString("dd_MM_yyyy_hh_mm_ss"); objComment.Title = "Xử lý Công văn đến: " + lblName.Text; objComment.Content = txtContent.Text; objComment.IDUserCreate = Global.UserInfo.UserName; objComment.IDDocument = DocumentId; objComment.IDWork = 0; objComment.Attachs = listFile; objComment.CreateDate = DateTime.Now; BobjComment.Add(objComment); ctl.Update(DocumentId, "", DateTime.Now.ToString(""), EOFFICE.Common.DocumentStatus.SendAgain.ToString("D")); } } catch (Exception ex) { } } } catch (Exception ex) { } } else { } Response.Redirect("/DocumentSend/DocumentProcess.aspx"); }
/// <summary> /// Gửi bản thảo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkSendDrap_Click(object sender, EventArgs e) { ODocument obj; BDocument ctl = new BDocument(); if (DocumentId != "") { try { obj = ctl.Get(DocumentId, int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D")))[0]; if (obj != null) { obj.Content = txtContent.Text; //obj.CreateDate = DateTime.Now; obj.SendDate = DateTime.Now; obj.ReceiveDate = DateTime.Now; obj.PublishDate = DateTime.Now; obj.StartProcess = DateTime.ParseExact(txtStartDate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); obj.EndProcess = DateTime.ParseExact(txtEndDate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); //obj.IDUserCreate = Global.UserInfo.UserID; string strFile = Upload(); string Attachs = obj.Attachs; if (strFile != ",") { Attachs = Attachs.Remove(Attachs.Length - 1, 1) + strFile; } obj.Attachs = Attachs; obj.Name = txtName.Text; obj.Priority = ddlLevel.SelectedValue; obj.PublishOffical = int.Parse(ddlOffical.SelectedValue); obj.UserProcess = GetUserProcess(); obj.IDDocumentKind = int.Parse(ddlType.SelectedValue); obj.Excerpt = txtSubContent.Text; obj.Status = EOFFICE.Common.DocumentStatus.SendDrap.ToString("D"); ctl.Update(obj.DocumentID, "", obj.Name, obj.Excerpt, obj.Content, "", obj.PublishOffical, obj.Attachs, obj.IDDocumentKind, "", obj.UserProcess, "", obj.StartProcess.ToString("MM/dd/yyyy"), obj.EndProcess.ToString("MM/dd/yyyy"), DateTime.Now.ToString("MM/dd/yyyy"), "", obj.SendOfficals, obj.Priority, obj.Status); Response.Redirect("/DocumentSend/Default.aspx"); } } catch (Exception ex) { } } else { obj = new ODocument(); obj.Content = txtContent.Text; obj.CreateDate = DateTime.Now; obj.SendDate = DateTime.Now; obj.ReceiveDate = DateTime.Now; obj.PublishDate = DateTime.Now; obj.StartProcess = DateTime.ParseExact(txtStartDate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); obj.EndProcess = DateTime.ParseExact(txtEndDate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); obj.IDUserCreate = Global.UserInfo.UserID; obj.Name = txtName.Text; obj.Priority = ddlLevel.SelectedValue; obj.PublishOffical = int.Parse(ddlOffical.SelectedValue); obj.UserProcess = GetUserProcess(); obj.IDDocumentKind = int.Parse(ddlType.SelectedValue); obj.Excerpt = txtSubContent.Text; obj.Attachs = Upload(); obj.Status = EOFFICE.Common.DocumentStatus.SendDrap.ToString("D"); obj.Type = int.Parse(EOFFICE.Common.DocumentType.DocumentSend.ToString("D")); ctl.Add(obj); Response.Redirect("/DocumentSend/Default.aspx"); } }