コード例 #1
0
        /// <summary>
        /// 由编辑区的输入获得DomainObject
        /// </summary>
        /// <returns></returns>
        protected override object GetEditObject()
        {
            //			this.ValidateInput();
            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

            if (_DocumentFacade == null)
            {
                _DocumentFacade = new DocumentFacade(base.DataProvider);
            }
            Doc doc = this._DocumentFacade.CreateNewDOC();

            if (this.txtDocDirQuery.Text.Trim() != string.Empty)
            {
                doc.Dirserial = int.Parse(this.txtDocDirQuery.Text.Trim());
            }
            else
            {
                doc.Dirserial = 0;
            }
            if (this.txtDocSerialEdit.Text.Trim() == string.Empty)
            {
                doc.Docserial = 0;
            }
            else
            {
                doc.Docserial = int.Parse(this.txtDocSerialEdit.Text.Trim());
            }

            doc.MaintainUser = this.GetUserCode();
            doc.Mdate        = dbDateTime.DBDate;
            doc.Mtime        = dbDateTime.DBTime;


            return(doc);
        }
コード例 #2
0
        /// <summary>
        /// 由编辑区的输入获得DomainObject
        /// </summary>
        /// <returns></returns>
        protected override object GetEditObject()
        {
            //			this.ValidateInput();

            if (_facade == null)
            {
                _facade = new DocumentFacade(base.DataProvider);
            }
            DBDateTime     currentDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
            DocDirForQuery docDir          = new DocDirForQuery();

            docDir.Dirserial           = this.txtDirSerialEdit.Text == "" ? 0 : int.Parse(this.txtDirSerialEdit.Text);
            docDir.Dirseq              = int.Parse(this.txtDirSequenceEdit.Text);
            docDir.Dirname             = FormatHelper.CleanString(this.txtDirNameEdit.Text, 40);
            docDir.Dirdesc             = FormatHelper.CleanString(this.txtMemoEdit.Text, 100);
            docDir.Pdirserial          = String.IsNullOrEmpty(this.drpParentDirCodeEdit.SelectedValue)?0:int.Parse(this.drpParentDirCodeEdit.SelectedValue);
            docDir.UploadUsergroupcode = FormatHelper.CleanString(this.txtUploadUserGroupEdit.Text, 200);
            docDir.QueryUsergroupcode  = FormatHelper.CleanString(this.txtQueryUserGroupEdit.Text, 200);
            docDir.CheckUsergroupcode  = FormatHelper.CleanString(this.txtCheckUserGroupEdit.Text, 200);
            docDir.Mdate        = currentDateTime.DBDate;
            docDir.Mtime        = currentDateTime.DBTime;
            docDir.MaintainUser = this.GetUserCode();


            return(docDir);
        }
コード例 #3
0
        public void systemHandler(Dictionary<String, Object> data)
        {


            // Retrive context from dictionary
            HttpContext context = (HttpContext)data["HttpResponse"];

            // Set type of expected string
            context.Response.ContentType = "text/html;charset=UTF-8";

            // Initialize Value
            String userEventJSONObject = "";
            String docUUID = "";

            // Get parameters from url
            userEventJSONObject = context.Request.Params["event"];
            docUUID = context.Request.Params["ticket"];
            try
            {
                // Authenticate user to see if it has firstly logged in if not then 
                // Redirect that person, also to see if event is not null as well as the uuid of new document
                if ((context.Session["userId"] == null &&
                    context.Session["userFistName"] == null &&
                    context.Session["userLastName"] == null) ||
                    (userEventJSONObject == null || userEventJSONObject == "") ||
                    (docUUID == null || docUUID == ""))
                {
                    context.Response.Redirect("", false);
                    context.ApplicationInstance.CompleteRequest();
                    return;
                }

                // get and set the properties to send across and insert them in database with extra property userId
                // The docVersion should not be hardcoded I am just tired and I want to get the big Pic done
                UserEvent userEvent = new UserEvent(
                                            docUUID
                                          , "JSON"
                                          , "CE"
                                          , userEventJSONObject
                                          , 2
                                          , DateTime.UtcNow
                                          , "UpdatedCalendarEvent"
                                          , (Decimal)context.Session["userId"]);

                //Send Object with all Data remotely to be stored eventually
                userDocumentsFacade = new DocumentFacade();
                userDocumentsFacade.updateEvent(userEvent);

                // Send New Event back again
                context.Response.Write(userEventJSONObject);



            }

            catch (Exception e)
            {
                e.ToString();
            }
        }
コード例 #4
0
        private bool CheckDocumentLevelPermissions(int docid, string role)
        {
            int      UserID = int.Parse(Request.Cookies["UserID"].Value);
            Document doc    = new DocumentFacade().GetDocumentDetails(docid);

            return(Framework.Security.SecurityBase.IsUserRoleAuthorized(UserID, doc.DepartmentID, doc.SubDepartmentID, role));
        }
コード例 #5
0
        /// <summary>
        /// 由编辑区的输入获得DomainObject
        /// </summary>
        /// <returns></returns>
        protected override object GetEditObject()
        {
            //			this.ValidateInput();
            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

            if (_DocumentFacade == null)
            {
                _DocumentFacade = new DocumentFacade(base.DataProvider);
            }
            Doc doc = this._DocumentFacade.CreateNewDOC();

            if (this.txtDocDirQuery.Text.Trim() != string.Empty)
            {
                doc.Dirserial = int.Parse(this.txtDocDirQuery.Text.Trim());
            }
            else
            {
                doc.Dirserial = 0;
            }
            if (this.txtDocSerialEdit.Text.Trim() == string.Empty)
            {
                doc.Docserial = 0;
            }
            else
            {
                doc.Docserial = int.Parse(this.txtDocSerialEdit.Text.Trim());
            }
            doc.Docname       = FormatHelper.CleanString(this.txtDocNameEdit.Text, 100);
            doc.Docnum        = FormatHelper.CleanString(this.txtDocNumEdit.Text, 100);
            doc.Doctype       = FormatHelper.CleanString(this.drpDocTypeEdit.Text, 40);
            doc.Docver        = FormatHelper.CleanString(this.txtDocVerEdit.Text, 100);
            doc.Docchgfile    = FormatHelper.CleanString(this.txtDocChgFileEdit.Text, 100);
            doc.Docchgnum     = FormatHelper.CleanString(this.txtDocChgNumEdit.Text, 40);
            doc.Keyword       = FormatHelper.CleanString(this.txtKeyWordEdit.Text, 2000);
            doc.Itemlist      = FormatHelper.CleanString(this.txtItemCodeEdit.Text, 400);
            doc.Validstatus   = FormatHelper.CleanString(this.drpValidStatus.SelectedValue, 1);
            doc.Checkedstatus = FormatHelper.CleanString(this.HiddenCheckedstatus.Text, 1);
            doc.Oplist        = FormatHelper.CleanString(this.txtOpCodeEdit.Text, 400);
            doc.Memo          = FormatHelper.CleanString(this.txtMemoEdit.Text, 2000);
            doc.MaintainUser  = this.GetUserCode();
            doc.Mdate         = dbDateTime.DBDate;
            doc.Mtime         = dbDateTime.DBTime;

            //如果是编辑,且编辑的时候没有勾选“文件”进行新的文件的上传,则不修改上传时间和上传人
            //也不清空ServerFullName(add by James)
            if (this.ViewState["actionType"].ToString() == "UPDATE")
            {
                doc.Upuser         = this.HiddenUpuser.Text;
                doc.Upfiledate     = FormatHelper.TODateInt(this.HiddenUpfiledate.Text);
                doc.ServerFileName = FormatHelper.CleanString(this.HiddenServerFullName.Text, 200);
            }
            else
            {
                doc.Upuser     = this.GetUserCode();
                doc.Upfiledate = dbDateTime.DBDate;
            }

            return(doc);
        }
コード例 #6
0
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         DocumentFacade facade = new DocumentFacade(uow);
         CurrentDocument = facade.RetrieveOrNewDocument(InstanceId, new DocumentConverter());
     }
 }
コード例 #7
0
 public IFacadeUpdateResult <DocumentData> SaveDocument(DocumentDto document)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CMSDataStoreKey))
     {
         DocumentFacade facade = new DocumentFacade(uow);
         return(facade.SaveDocument(DocumentConverter.ConvertToData(document)));
     }
 }
コード例 #8
0
 public DocumentDto GetDocument(int id)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CMSDataStoreKey))
     {
         DocumentFacade facade = new DocumentFacade(uow);
         return(facade.RetrieveOrNewDocument(id, new DocumentConverter()));
     }
 }
コード例 #9
0
 public IEnumerable <DocumentDto> GetList(int folderId)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CMSDataStoreKey))
     {
         DocumentFacade facade = new DocumentFacade(uow);
         return(facade.RetrieveAllDocument(new DocumentConverter()));
     }
 }
コード例 #10
0
 protected override int GetRowCount()
 {
     if (_facade == null)
     {
         _facade = new DocumentFacade(base.DataProvider);
     }
     return(this._facade.QuerySubDOCDIRCount(int.Parse(FormatHelper.CleanString(this.txtDocDirQuery.Text))));
 }
コード例 #11
0
 private ITreeObjectNode LoadDocumentTreeToApplication()
 {
     if (_facade == null)
     {
         _facade = new DocumentFacade(base.DataProvider);
     }
     return(this._facade.BuildDocumentTree());
 }
コード例 #12
0
 protected override int GetRowCount()
 {
     if (_DocumentFacade == null)
     {
         _DocumentFacade = new DocumentFacade(base.DataProvider);
     }
     return(this._DocumentFacade.QueryDocumentsCount(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtDocDirQuery.Text))));
 }
コード例 #13
0
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         DocumentFacade facade = new DocumentFacade(uow);
         RetrieveInstances(facade);
     }
 }
コード例 #14
0
 protected override object[] LoadDataSource(int inclusive, int exclusive)
 {
     if (_facade == null)
     {
         _facade = new DocumentFacade(base.DataProvider);
     }
     return(this._facade.QuerySubDOCDIR(int.Parse(FormatHelper.CleanString(this.txtDocDirQuery.Text)), inclusive, exclusive));
 }
コード例 #15
0
 protected override object[] LoadDataSource(int inclusive, int exclusive)
 {
     if (_DocumentFacade == null)
     {
         _DocumentFacade = new DocumentFacade(base.DataProvider);
     }
     return(this._DocumentFacade.QueryDocuments(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtDocDirQuery.Text)), inclusive, exclusive));
 }
コード例 #16
0
        public void SetUp()
        {
            var solutionFacade = new SolutionFacade(@"C:\dev\diploma\CodeAnalyzing\Tests\TestSolutionFramework.sln");
            var project        = solutionFacade.GetProjects(x => x.Name == "TestFrameworkProject").First();
            var projectFacade  = new ProjectFacade(project);
            var document       = projectFacade.GetDocuments(x => x.Name == "TestClassForNamesGetting.cs").First();

            _documentFacade = new DocumentFacade(document);
        }
コード例 #17
0
        protected override void Grid_ClickCell(GridRecord row, string commandName)
        {
            try
            {
                if (commandName == "DOCNAME")
                {
                    if (_DocumentFacade == null)
                    {
                        _DocumentFacade = new DocumentFacade(this.DataProvider);
                    }
                    if (_DocumentFacade.GetDocDirRight(int.Parse(this.txtDocDirQuery.Text.Trim()), this.GetUserCode(), "QUERY"))
                    {
                        //下载文件
                        //if (_facade == null)
                        //{
                        //    _facade = new SystemSettingFacade(this.DataProvider);
                        //}
                        //object parameter = _facade.GetParameter("DOCDIRPATH", "DOCDIRPATHGROUP");
                        //if (parameter != null)
                        //{
                        //    //服务器目录路径
                        //    string filePath = ((Domain.BaseSetting.Parameter)parameter).ParameterAlias;
                        //    if (filePath.LastIndexOf('\\') == filePath.Length - 1)
                        //    {
                        //        filePath = filePath.Substring(0, filePath.Length - 1);
                        //    }
                        string filePath = System.AppDomain.CurrentDomain.BaseDirectory + "FileUpload";

                        #region  载文件
                        FileInfo currentFile = new FileInfo(filePath + "/" + row.Items.FindItemByKey("ServerFullName").Value.ToString());
                        if (currentFile.Exists)
                        {
                            this.DownloadFileFull(this.VirtualHostRoot + "FileUpload/" + row.Items.FindItemByKey("ServerFullName").Value.ToString());
                        }
                        else
                        {
                            WebInfoPublish.PublishInfo(this, "$Error_QueryFile_NotExist", this.languageComponent1);
                        }
                        #endregion
                        //}
                        //else
                        //{
                        //    WebInfoPublish.PublishInfo(this, "$Error_DocDirPath_NotExist", this.languageComponent1);
                        //}
                    }
                    else
                    {
                        WebInfoPublish.PublishInfo(this, "$Error_No_WatchFile_Right", this.languageComponent1);
                    }
                }
            }
            catch (Exception ex)
            {
                WebInfoPublish.PublishInfo(this, "$Error_QueryFile_Exception", this.languageComponent1);
            }
        }
コード例 #18
0
        public ActionResult SaveChangeRequest(DocumentChangeRequest model)
        {
            model.Comment1By = Request.Cookies["UserName"].Value;
            int OrgID         = int.Parse(Request.Cookies["OrgID"].Value);
            int requestNumber = new DocumentFacade().SaveChangeRequest(model, Request.Cookies["UserEmail"].Value, OrgID);

            TempData.Clear();
            this.ShowMessage(Helpers.MessageType.Success, "Change request submitted successfully.");
            return(RedirectToAction("Index", "DocumentLibrary"));
        }
コード例 #19
0
        public void systemHandler(Dictionary <String, Object> data)
        {
            // Retrive context from dictionary
            HttpContext context = (HttpContext)data["HttpResponse"];

            // Set type of expected string
            context.Response.ContentType = "text/html;charset=UTF-8";

            // Initialize Value
            String userEventJSONObject = "";
            String docUUID             = "";

            // Get parameters from url
            userEventJSONObject = context.Request.Params["event"];
            docUUID             = context.Request.Params["ticket"];
            try
            {
                // Authenticate user to see if it has firstly logged in if not then
                // Redirect that person, also to see if event is not null as well as the uuid of new document
                if ((context.Session["userId"] == null &&
                     context.Session["userFistName"] == null &&
                     context.Session["userLastName"] == null) ||
                    (userEventJSONObject == null || userEventJSONObject == "") ||
                    (docUUID == null || docUUID == ""))
                {
                    context.Response.Redirect("", false);
                    context.ApplicationInstance.CompleteRequest();
                    return;
                }

                // get and set the properties to send across and insert them in database with extra property userId
                // The docVersion should not be hardcoded I am just tired and I want to get the big Pic done
                UserEvent userEvent = new UserEvent(
                    docUUID
                    , "JSON"
                    , "CE"
                    , userEventJSONObject
                    , 2
                    , DateTime.UtcNow
                    , "UpdatedCalendarEvent"
                    , (Decimal)context.Session["userId"]);

                //Send Object with all Data remotely to be stored eventually
                userDocumentsFacade = new DocumentFacade();
                userDocumentsFacade.updateEvent(userEvent);

                // Send New Event back again
                context.Response.Write(userEventJSONObject);
            }

            catch (Exception e)
            {
                e.ToString();
            }
        }
コード例 #20
0
        //
        // GET: /Account
        public ActionResult DCR()
        {
            int            OrgID              = int.Parse(Request.Cookies["OrgID"].Value);
            DocumentFacade facade             = new DocumentFacade();
            List <DocumentChangeRequest> list = new List <DocumentChangeRequest>();

            list         = facade.GetDocumentChangeRequestList(OrgID);
            ViewBag.DCRs = list;

            return(View("DCR"));
        }
コード例 #21
0
 private void RetrieveInstances(DocumentFacade facade)
 {
     if (CurrentUserContext.IsAdmin)
     {
         CurrentInstances = facade.RetrieveAllDocument(new DocumentConverter());
     }
     else if (CurrentUserContext.IsEmployee)
     {
         CurrentInstances = facade.RetrieveDocumentsByUser(CurrentUserContext.User.UserId, new DocumentConverter());
     }
 }
コード例 #22
0
        public JsonResult BuildDocumentList(string dept, string subdept)
        {
            var doclist = new List <Document>();
            int OrgID   = int.Parse(Request.Cookies["OrgID"].Value);
            int UserID  = 0;

            int.TryParse(Request.Cookies["UserID"].Value, out UserID);
            string UserEmail = Request.Cookies["UserEmail"].Value;

            doclist = new DocumentFacade().GetDocumentDetailsList(OrgID, UserID, Convert.ToInt32(dept), Convert.ToInt32(subdept));
            return(Json(doclist, JsonRequestBehavior.AllowGet));
        }
コード例 #23
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            DocumentFacade _documentFacade = new DocumentFacade(this.DataProvider);

            object[] objs = _documentFacade.QueryDocuments(this.txtDocnameQuery.Value,
                                                           this.txtDocnumQuery.Value,
                                                           this.txtMcodelistQuery.Value,
                                                           this.txtOplistQuery.Value,
                                                           this.txtKeywordQuery.Value,
                                                           this.txtMemoQuery.Value,
                                                           FormatString(this.drpDoctypeQuery.SelectedItemValue),
                                                           FormatString(this.drpValidStatusQuery.SelectedItemValue),
                                                           FormatString(this.drpCheckedStatusQuery.SelectedItemValue),
                                                           1,
                                                           int.MaxValue
                                                           );
            _DataTableLoadedPart.Clear();

            if (objs == null)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_No_Data_To_Display"));
                return;
            }

            for (int i = 0; i < objs.Length; i++)
            {
                DocForQuery doc = objs[i] as DocForQuery;
                _DataTableLoadedPart.Rows.Add(new object[] {
                    doc.Docserial.ToString(),
                    doc.Dirserial.ToString(),
                    doc.Docname.ToString(),
                    doc.Docnum.ToString(),
                    doc.Docver.ToString(),
                    doc.DirName.ToString(),
                    doc.Itemlist.ToString(),
                    doc.Oplist.ToString(),
                    doc.Docchgnum.ToString(),
                    doc.Docchgfile.ToString(),
                    doc.Memo.ToString(),
                    doc.Keyword.ToString(),
                    doc.Doctype.ToString(),
                    MutiLanguages.ParserString(doc.Checkedstatus),
                    MutiLanguages.ParserString(doc.Validstatus),
                    FormatHelper.ToDateString(doc.Upfiledate),
                    doc.GetDisplayText("Upuser"),
                    FormatHelper.ToDateString(doc.Mdate),
                    doc.GetDisplayText("MaintainUser"),
                    FormatHelper.ToTimeString(doc.Mtime),
                    doc.ServerFileName.ToString()
                });
            }
        }
コード例 #24
0
        public ActionResult ChangeRequest(int id, int dcr)
        {
            bool isAuthorized = CheckDocumentLevelPermissions(id, "Raise Change Request");

            ViewBag.HideGenerateButton = false;
            if (isAuthorized)
            {
                DocumentFacade        facade   = new DocumentFacade();
                DocumentChangeRequest dcrmodel = new DocumentChangeRequest();

                dcrmodel = facade.GetDocumentChangeRequest(id, dcr);

                dcrmodel.SelectedDocument = facade.GetDocumentDetails(id > 0 ? id : dcrmodel.DocumentID);
                if (!string.IsNullOrWhiteSpace(dcrmodel.RequestNumber))
                {
                    ViewBag.HideGenerateButton = true;
                }

                int             OrgID   = int.Parse(Request.Cookies["OrgID"].Value);
                List <Document> doclist = new DocumentFacade().GetDocumentDetailsList(OrgID, 0, dcrmodel.SelectedDocument.DepartmentID, 0);

                // Build document list from department docs
                List <EffectedDocuments> effDocList = new List <EffectedDocuments>();
                foreach (Document doc in doclist)
                {
                    effDocList.Add(new EffectedDocuments()
                    {
                        DocumentID = doc.DocumentID, DocumentName = doc.DocumentName, DocumentNumber = doc.DocumentNumber, VersionString = doc.VersionString, NextVersion = doc.NextVersion.ToString("N")
                    });
                }
                dcrmodel.DepartmentDocumentsList = effDocList;

                List <EffectedDocuments> result = new List <EffectedDocuments>();
                if (!string.IsNullOrWhiteSpace(dcrmodel.EffectedDocumentIDs))
                {
                    List <string> items = dcrmodel.EffectedDocumentIDs.Split(',').ToList();
                    result = effDocList.Where(item => items.Any(category => category.Equals(item.DocumentID.ToString()))).ToList();
                }
                // Build effected documents list for change request
                dcrmodel.EffectedDocuments = result;

                ViewData["DocList"] = JsonHelper.JsonSerializer(effDocList, typeof(List <EffectedDocuments>));

                // return Json(doclist, JsonRequestBehavior.AllowGet);

                return(View("ChangeRequest", dcrmodel));
            }
            else
            {
                throw new Exception("Access denied! You donot have permissions on change request.");
            }
        }
コード例 #25
0
        public JsonResult GetDocumentHistory(int id)
        {
            bool isAuthorized = CheckDocumentLevelPermissions(id, "Doc History");

            if (isAuthorized)
            {
                var doclist = new List <Document>();
                doclist = new DocumentFacade().GetDocumentHistory(id);
                return(Json(doclist, JsonRequestBehavior.AllowGet));
            }
            else
            {
                throw new Exception("Access denied! You donot have permissions to view history.");
            }
        }
コード例 #26
0
        /// <summary>
        /// 将指定行的记录写入编辑区
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        protected override object GetEditObject(GridRecord row)
        {
            if (_facade == null)
            {
                _facade = new DocumentFacade(base.DataProvider);
            }
            object obj = _facade.QuerySubDOCDIR(int.Parse(row.Items.FindItemByKey("DirSerial").Text));

            if (obj != null)
            {
                return((DocDirForQuery)obj);
            }

            return(null);
        }
コード例 #27
0
        public List <Document> GetDocuments(int orgID, int deptID = 0, int subDeptID = 0)
        {
            List <Document> docList = new DocumentFacade().GetDocumentList(orgID);

            if (deptID > 0)
            {
                docList = docList.FindAll(delegate(Document s) { return(s.DepartmentID == deptID); });
            }
            if (subDeptID > 0)
            {
                docList = docList.FindAll(delegate(Document s) { return(s.DepartmentID == deptID && s.SubDepartmentID == subDeptID); });
            }

            return(docList);
        }
コード例 #28
0
        /// <summary>
        /// 将指定行的记录写入编辑区
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        protected override object GetEditObject(GridRecord row)
        {
            if (_DocumentFacade == null)
            {
                _DocumentFacade = new DocumentFacade(base.DataProvider);
            }
            object obj = _DocumentFacade.GetDOC(int.Parse(row.Items.FindItemByKey("DOCSERIAL").Text.ToString()));

            if (obj != null)
            {
                return((Doc)obj);
            }

            return(null);
        }
コード例 #29
0
        public JsonResult DeleteDocument(int docid)
        {
            // Check permission
            bool isAuthorized = CheckDocumentLevelPermissions(docid, "Doc Delete");

            if (isAuthorized)
            {
                string user    = Request.Cookies["UserEmail"].Value;
                bool   success = new DocumentFacade().DeleteDocument(docid, user);
                return(Json(success));
            }
            else
            {
                throw new Exception("Access denied! You donot have permissions to delete the document.");
            }
        }
コード例 #30
0
        public ActionResult Revise(int id)
        {
            Document docmodel = new DocumentFacade().GetDocumentDetails(id);
            var      dept     = new DepartmentService().GetDepartmentDetails(docmodel.DepartmentID);

            docmodel.DepartmentName = dept.DepartmentName;
            if (dept.SubDepartments != null)
            {
                var subdept = dept.SubDepartments.Where(item => item.SubDepartmentID.Equals(docmodel.SubDepartmentID)).ToList();
                if (subdept.Count > 0)
                {
                    docmodel.SubDepartmentName = subdept[0].SubDepartmentName;
                }
            }
            return(View("Revise", docmodel));
        }
コード例 #31
0
        public JsonResult CheckoutDocument(int docid, bool status)
        {
            // Check permission
            bool isAuthorized = CheckDocumentLevelPermissions(docid, "Doc Review");

            if (isAuthorized)
            {
                string user    = Request.Cookies["UserEmail"].Value;
                bool   success = new DocumentFacade().CheckoutDocument(docid, status, user);
                return(Json(success));
            }
            else
            {
                throw new Exception("Access denied! You donot have permissions to review/revise the document.");
            }
        }
コード例 #32
0
        public void systemHandler(Dictionary<String, Object> data)
        {
            try
            {

                // Retrive context from dictionary
                HttpContext context = (HttpContext)data["HttpResponse"];

                // Set type of expected string
                context.Response.ContentType = "text/html;charset=UTF-8";

                // Authenticate user to see if it has firstly logged in if not then 
                // Redirect that person
                if (context.Session["userId"] == null &&
                    context.Session["userFistName"] == null &&
                    context.Session["userLastName"] == null)
                {
                    context.Response.Redirect("", false);
                    context.ApplicationInstance.CompleteRequest();
                    return;
                }

                // Get person that user wish to talk with from URL
                Decimal personToTalkWith = Convert.ToDecimal(context.Request.Params["to"]);

                // Dictionary to hold data to be returned
                Dictionary<String, Object> portalData = null;

                    // Retrive Person Id
                    Decimal personLogged = (Decimal)context.Session["userId"];

                    // Let us get all the users in the ChatRoom
                    userDocumentsFacade = new DocumentFacade();
                    portalData = userDocumentsFacade.getChatConversation(personLogged, personToTalkWith);

                    // Make sure PortalData is not null if its then return
                    if (portalData == null){                    
                        context.ApplicationInstance.CompleteRequest();
                        return;
                    }

                    
                    if (portalData.ContainsKey("chatMessages")){
                        chatConversation = (List<ChatMessagesSerializable>)portalData["chatMessages"];
                    } else {
                        // Redirect with error
                        context.ApplicationInstance.CompleteRequest();
                        return; 
                    }

                    String test = JsonConvert.SerializeObject(portalData);

                    // Send Object Serialized
                    context.Response.Write(JsonConvert.SerializeObject(portalData));


                   
            }
            catch (Exception e)
            {
                e.ToString();
            }



        }
コード例 #33
0
        public void systemHandler(Dictionary<String, Object> data)
        {


            // Retrive context from dictionary
            HttpContext context = (HttpContext)data["HttpResponse"];

            // Set type of expected string
            context.Response.ContentType = "text/html;charset=UTF-8";

            // Initialize Value
            String userEventJSONObject = "";
            String docUUID = "";

            // Get parameters from url
            userEventJSONObject = context.Request.Params["event"];
            docUUID = context.Request.Params["ticket"]; 

            // Send values to be evaluated
            try
            {
                // Authenticate user to see if it has firstly logged in if not then 
                // Redirect that person, also to see if event is not null as well as the uuid of new document
                if ((context.Session["userId"] == null &&
                    context.Session["userFistName"] == null &&
                    context.Session["userLastName"] == null) ||
                    (userEventJSONObject == null || userEventJSONObject == "") ||
                    (docUUID == null || docUUID == ""))
                {
                    context.Response.Redirect("", false);
                    context.ApplicationInstance.CompleteRequest();
                    return;
                }
               
                // get and set the properties to send across and insert them in database with extra property userId
                UserEvent userEvent = new UserEvent(
                                            docUUID
                                          , "JSON"
                                          , "CE"
                                          , userEventJSONObject
                                          , 1
                                          , DateTime.UtcNow
                                          , "NewUserCalendarEvent"
                                          , (Decimal)context.Session["userId"]);

                //Send Object with all Data remotely to be stored eventually
                userDocumentsFacade = new DocumentFacade();
                userDocumentsFacade.setEvent(userEvent);

                // I was thinking on hitting the DB again by executing a Store Proc that can retrive ONLY the new inserted Row 
                // But since it will go its way I can just send back the JSON string I just saved to the view without having to retrive it again 
                // From the DB, if its an error its going... I should change the interface so that it returns a success of fail and then evaluate
                // Whether to send back a null for failure or the event back, REMINDER: I'll do it after I can update and delete events
                 //String test = JsonConvert.SerializeObject(portalData);

                // Send New Event back again
                context.Response.Write(userEventJSONObject);
                


            }

            catch (Exception e)
            {
                e.ToString();
            }
        }