コード例 #1
0
        protected void rptListUser_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int WorkID = int.Parse(Request.QueryString["WorkID"].ToString());

            if (e.CommandName == "trigger")
            {
                LinkButton btn = e.CommandSource as LinkButton;

                if (btn != null)
                {
                    RepeaterItem ri    = e.Item;
                    HiddenField  hdfID = (HiddenField)ri.FindControl("hdfID");

                    BComment BobjComment = new BComment();
                    OComment objComment  = new OComment();
                    if (BobjComment.GetCreate(hdfID.Value, WorkID).Count == 0)
                    {
                        lblMessage.Text        = "Chưa có nội dung xử lý!";
                        rptComment.Visible     = false;
                        rptFileAttachs.Visible = false;
                    }
                    else
                    {
                        rptComment.Visible     = true;
                        rptFileAttachs.Visible = true;
                        lblMessage.Text        = "";
                        objComment             = BobjComment.GetCreate(hdfID.Value, WorkID).First();
                        rptComment.DataSource  = BobjComment.GetCreate(hdfID.Value, WorkID);
                        rptComment.DataBind();

                        List <OAttach> listAttach = new List <OAttach>();
                        foreach (OComment obj in BobjComment.GetCreate(hdfID.Value, WorkID))
                        {
                            listAttach = listAttach.Union(BobjComment.GetAttachs(obj.CommentID)).ToList();
                        }
                        rptFileAttachs.DataSource = listAttach;
                        rptFileAttachs.DataBind();
                    }
                }
            }
        }
コード例 #2
0
        public bool Add(OComment obj)
        {
            SqlParameter[] sqlPara = new SqlParameter[8];
            sqlPara[0]       = new SqlParameter("@CommentID", SqlDbType.VarChar);
            sqlPara[0].Value = obj.CommentID;
            sqlPara[1]       = new SqlParameter("@Title", SqlDbType.NVarChar);
            sqlPara[1].Value = obj.Title;
            sqlPara[2]       = new SqlParameter("@Content", SqlDbType.NVarChar);
            sqlPara[2].Value = obj.Content;
            sqlPara[3]       = new SqlParameter("@IDUserCreate", SqlDbType.VarChar);
            sqlPara[3].Value = obj.IDUserCreate;
            sqlPara[4]       = new SqlParameter("@IDDocument", SqlDbType.VarChar);
            sqlPara[4].Value = obj.IDDocument;
            sqlPara[5]       = new SqlParameter("@IDWork", SqlDbType.Int);
            sqlPara[5].Value = obj.IDWork;
            sqlPara[6]       = new SqlParameter("@Attachs", SqlDbType.VarChar);
            sqlPara[6].Value = obj.Attachs;
            sqlPara[7]       = new SqlParameter("@CreateDate", SqlDbType.DateTime);
            sqlPara[7].Value = obj.CreateDate;

            return(RunProcudure("sp_tblComment_add", sqlPara));
        }
コード例 #3
0
        protected void btnCapNhat_Click(object sender, EventArgs e)
        {
            BWork BobjWork = new BWork();
            //Lấy IDWWork
            int WorkID = int.Parse(Request.QueryString["WorkID"].ToString());
            //Lấy IDUserCreate
            string IDUserCreate = Global.UserInfo.UserName;//Lấy lại sau
            //Lấy nội dung xử lý
            string Content = txtContent.Text;
            //Upload File
            DateTime CurrentTime = DateTime.Now;
            string   day         = CurrentTime.Day.ToString();
            string   month       = CurrentTime.Month.ToString();
            string   year        = CurrentTime.Year.ToString();
            string   hour        = CurrentTime.Hour.ToString();
            string   minute      = CurrentTime.Minute.ToString();
            string   millisecond = CurrentTime.Millisecond.ToString();
            string   str         = "-" + day + "-" + month + "-" + year + "-" + "-" + hour + "-" + minute + "-" + millisecond;
            //Lấy danh sách file đính kèm
            BAttach            Bobj = new BAttach();
            HttpFileCollection hfc  = Request.Files;
            int    n        = hfc.Count;
            string listFile = ",";

            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("/MyFiles") + "/" + System.IO.Path.GetFileNameWithoutExtension(hpf.FileName).Replace(" ", "_") + str + System.IO.Path.GetExtension(hpf.FileName));
                            OAttach obj = new OAttach();
                            obj.Name        = System.IO.Path.GetFileName(hpf.FileName);
                            obj.Path        = "~/MyFiles" + "/" + System.IO.Path.GetFileNameWithoutExtension(hpf.FileName).Replace(" ", "_") + str + System.IO.Path.GetExtension(hpf.FileName);
                            obj.Description = "";
                            Bobj.Add(obj);
                            listFile += Bobj.GetLast().FirstOrDefault().AttachID.ToString() + ",";
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            //Lấy danh sách người chuyển tiếp
            string UserJoin = hdfUsers.Value;

            if (UserJoin == ",")
            {
                UserJoin = "";
            }

            //////////////////////////////////////////////
            //Tạo Comment mới
            BComment BobjComment = new BComment();
            OComment objComment  = new OComment();

            objComment.CommentID    = WorkID.ToString() + "" + CurrentTime.ToString();
            objComment.Title        = "Xử lý công việc: " + BobjWork.GetWork(WorkID).First().Name;
            objComment.Content      = Content;
            objComment.IDUserCreate = IDUserCreate;
            objComment.IDDocument   = "";
            objComment.IDWork       = WorkID;
            objComment.Attachs      = listFile;
            objComment.CreateDate   = CurrentTime;

            BobjComment.Add(objComment);

            //Thêm danh sách người chuyển tiếp nếu có chuyển tiếp

            if (UserJoin != "")
            {
                OWork objWork = new OWork();
                objWork = BobjWork.GetWork(WorkID).First();
                //Xử lý người chuyển tiếp trùng lặp
                string CurrentList = objWork.IDUserProcess;

                string[] divUser = UserJoin.Split(',');

                for (int i = 0; i < divUser.Count(); i++)
                {
                    divUser[i]  = "," + divUser[i] + ",";
                    CurrentList = CurrentList.Replace(divUser[i], ",");
                }
                string newlistUserProcess = CurrentList + UserJoin;
                BobjWork.UpdateUserProcess(WorkID, newlistUserProcess, objWork.IDUserCreate);   //Lấy IDUserCreate sau
            }

            Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
        }
コード例 #4
0
        /// <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");
        }