Ejemplo n.º 1
0
        protected void cmdCheck_ServerClick(object sender, EventArgs e)
        {
            if (_DocumentFacade == null)
            {
                _DocumentFacade = new DocumentFacade(base.DataProvider);
            }


            if (gridHelper == null)
            {
                gridHelper = new GridHelperNew(this.gridWebGrid, this.DtSource);
            }

            try
            {
                if (!_DocumentFacade.GetDocDirRight(int.Parse(this.txtDocDirQuery.Text.Trim()), this.GetUserCode(), "CHECK"))
                {
                    WebInfoPublish.PublishInfo(this, "$Error_No_CheckFile_Right", this.languageComponent1);
                    return;
                }
                this.DataProvider.BeginTransaction();
                foreach (object obj in gridHelper.GetCheckedRows())
                {
                    int serial = int.Parse((obj as GridRecord).Items.FindItemByKey("DOCSERIAL").Value.ToString());
                    Doc doc    = (Doc)_DocumentFacade.GetDOC(serial);
                    doc.Checkedstatus = "Y";
                    _DocumentFacade.UpdateDOC(doc);
                }
                this.DataProvider.CommitTransaction();
                this.gridHelper.RefreshData();
                WebInfoPublish.PublishInfo(this, "$Success_Check", this.languageComponent1);
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                WebInfoPublish.PublishInfo(this, "$Error_Check_Exception", this.languageComponent1);
            }
        }
Ejemplo n.º 2
0
        private void ultraGridScrutiny_ClickCell(object sender, ClickCellEventArgs e)
        {
            try
            {
                if (e.Cell.Column.Key == "Docname")
                {
                    if (_documentFacade == null)
                    {
                        _documentFacade = new DocumentFacade(this.DataProvider);
                    }

                    bool right = _documentFacade.GetDocDirRight(int.Parse(e.Cell.Row.Cells[1].Value.ToString()), ApplicationService.Current().UserCode, "QUERY");
                    Doc  doc   = _documentFacade.GetDOC(int.Parse(e.Cell.Row.Cells[0].Value.ToString())) as Doc;

                    if (right)
                    {
                        if (doc.Checkedstatus == "Y" && doc.Validstatus == "Y")
                        {
                            if (_facade == null)
                            {
                                _facade = new SystemSettingFacade(this.DataProvider);
                            }
                            object parameter = _facade.GetParameter("PUBLISHDOCDIRPATH", "PUBLISHDOCDIRPATHGROUP");
                            if (parameter != null)
                            {
                                //发布服务器目录路径
                                string filePath = ((Domain.BaseSetting.Parameter)parameter).ParameterAlias;
                                if (filePath.LastIndexOf('/') == filePath.Length - 1)
                                {
                                    filePath = filePath.Substring(0, filePath.Length - 1);
                                }

                                #region//下载文件
                                if (e.Cell.Row.Cells[20].Value.ToString().Trim() != string.Empty)
                                {
                                    //服务器文件名
                                    string fileName = e.Cell.Row.Cells[20].Value.ToString();
                                    System.Diagnostics.Process.Start(filePath + "/" + fileName + "?tmp=" + (new System.Random()).Next(1000000).ToString());
                                }
                                else
                                {
                                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$Error_QueryFile_NotExist"));
                                }
                                #endregion
                            }
                            else
                            {
                                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$Error_PublishDocDirPath_NotExist"));
                            }
                        }
                        else
                        {
                            ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$Error_FileIsNotCheckedOrValid"));
                        }
                    }
                    else
                    {
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$Error_HaveNoRightToDownload"));
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_QueryFile_Exception"));
            }
        }
Ejemplo n.º 3
0
        protected override void Grid_ClickCell(GridRecord row, string commandName)
        {
            try
            {
                if (commandName == "Docname")
                {
                    if (_documentFacade == null)
                    {
                        _documentFacade = new DocumentFacade(this.DataProvider);
                    }

                    bool right = _documentFacade.GetDocDirRight(int.Parse(row.Items.FindItemByKey("Dirserial").Value.ToString()), this.GetUserCode(), "QUERY");
                    Doc  doc   = _documentFacade.GetDOC(int.Parse(row.Items.FindItemByKey("Docserial").Value.ToString())) as Doc;

                    if (right)
                    {
                        if (doc.Checkedstatus == "Y" && doc.Validstatus == "Y")
                        {
                            if (_facade == null)
                            {
                                _facade = new SystemSettingFacade(this.DataProvider);
                            }
                            //object parameter = _facade.GetParameter("DOCDIRPATH", "DOCDIRPATHGROUP");
                            //if (parameter != null)
                            //{
                            //服务器目录路径
                            //string filePath = ((Domain.BaseSetting.Parameter)parameter).ParameterAlias;
                            string filePath = System.AppDomain.CurrentDomain.BaseDirectory
                                              + "FileUpload";
                            if (filePath.LastIndexOf('\\') == filePath.Length - 1)
                            {
                                filePath = filePath.Substring(0, filePath.Length - 1);
                            }

                            #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_FileIsNotCheckedOrValid", this.languageComponent1);
                        }
                    }
                    else
                    {
                        WebInfoPublish.PublishInfo(this, "$Error_HaveNoRightToDownload", this.languageComponent1);
                    }
                }
            }
            catch (Exception ex)
            {
                WebInfoPublish.PublishInfo(this, "$Error_QueryFile_Exception", this.languageComponent1);
            }
        }
Ejemplo n.º 4
0
        private bool UpLoadFile(string action, Doc doc)
        {
            //如果选中文件
            if (this.chbFileCheckedEdit.Checked)
            {
                //if (this.fileUpLoadEdit.HasFile)
                //{
                try
                {
                    if (_facade == null)
                    {
                        _facade = new SystemSettingFacade(this.DataProvider);
                    }
                    //object parameter = _facade.GetParameter("DOCDIRPATH", "DOCDIRPATHGROUP");
                    //if (parameter != null)
                    //{
                    //服务器目录路径
                    string filePath = System.AppDomain.CurrentDomain.BaseDirectory
                                      + "FileUpload"; //((Domain.BaseSetting.Parameter)parameter).ParameterAlias;

                    if (!Directory.Exists(filePath))
                    {
                        Directory.CreateDirectory(filePath);
                    }

                    if (filePath.LastIndexOf('\\') == filePath.Length - 1)
                    {
                        filePath = filePath.Substring(0, filePath.Length - 1);
                    }

                    int maxDocSerial = -1;
                    if (action == "ADD")
                    {
                        //文档的序号
                        maxDocSerial = _DocumentFacade.GetDocMaxSerial();
                    }
                    else
                    {
                        maxDocSerial = doc.Docserial;
                    }

                    Doc objDoc = _DocumentFacade.GetDOC(maxDocSerial) as Doc;

                    if (objDoc != null)
                    {
                        DirectoryInfo dir = new DirectoryInfo(filePath);

                        foreach (FileInfo file in dir.GetFiles())
                        {
                            if (file.Name == (objDoc as Doc).ServerFileName)
                            {
                                file.Delete();
                            }
                        }

                        /// '检查文件扩展名字
                        HttpPostedFile postedFile = fileUpload.PostedFile;
                        string         fileName;
                        fileName = System.IO.Path.GetFileName(postedFile.FileName);
                        if (fileName != "")
                        {
                            string serverFullName = fileName.Substring(0, fileName.LastIndexOf(".")) + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + fileName.Substring(fileName.LastIndexOf("."));;
                            objDoc.ServerFileName = serverFullName;
                            objDoc.Checkedstatus  = "N";
                            _DocumentFacade.UpdateDOC(objDoc);
                            string currentPath = filePath + "\\" + serverFullName;
                            postedFile.SaveAs(currentPath);
                        }



                        WebInfoPublish.PublishInfo(this, "$Success_UpLoadFile", this.languageComponent1);
                    }
                    return(true);
                    //}
                    //else
                    //{
                    //    WebInfoPublish.PublishInfo(this, "$Error_DocDirPath_NotExist", this.languageComponent1);
                    //    return false;
                    //}
                }
                catch (Exception ex)
                {
                    WebInfoPublish.PublishInfo(this, "$Error_UpLoadFile_Exception", this.languageComponent1);
                    return(false);
                }
                //}
            }
            return(true);
        }