示例#1
0
        void cmdFinishTask_Click(object sender, Janus.Windows.UI.CommandBars.CommandEventArgs e)
        {
            TreeNode selectedNode = this.tvTask.SelectedNode;

            if (selectedNode == null)
            {
                XMessageBox.ShowError("请选择要结束的任务!");
                return;
            }

            XTaskInfo taskInfo = selectedNode.Tag as XTaskInfo;

            if (taskInfo == null)
            {
                XMessageBox.ShowError("请选择要结束的任务!");
                return;
            }

            if (XMessageBox.ShowQuestion("确定要结束选中的任务吗?") == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            if (this.m_TaskBusiness.UpdateTaskStatus("结束", taskInfo.ID))
            {
                XMessageBox.ShowRemindMessage("结束任务成功!");
            }
            else
            {
                XMessageBox.ShowError("结束任务失败!");
            }
        }
示例#2
0
        void cmdDownload_Click(object sender, Janus.Windows.UI.CommandBars.CommandEventArgs e)
        {
            if (this.tvTask.SelectedNode != null)
            {
                XTaskFilesInfo model = this.tvTask.SelectedNode.Tag as XTaskFilesInfo;

                string mainId = model.RID;

                bool isExist = this.m_FileAttachBusiness.IsFileExist(mainId);
                if (!isExist)
                {
                    XMessageBox.ShowError("未找到附件!");
                    return;
                }

                FolderBrowserDialog fbd = new FolderBrowserDialog();
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string fileName = this.m_FileAttachBusiness.DownloadFile(mainId, fbd.SelectedPath);

                    if (fileName != string.Empty)
                    {
                        XMessageBox.ShowRemindMessage("下载完成!");
                    }
                    else
                    {
                        XMessageBox.ShowError("下载失败!");
                    }
                }
            }
            else
            {
                XMessageBox.ShowError("请选择要下载附件的记录!");
            }
        }
示例#3
0
        public static int SaveOptions(this options options_to_save, SccompDbf selected_comp)
        {
            try
            {
                using (LocalDbEntities db = DBX.DataSet(selected_comp))
                {
                    options option = db.options.Where(o => o.key == options_to_save.key).FirstOrDefault();
                    if (option != null) // update
                    {
                        option.value_datetime = options_to_save.value_datetime;
                        option.value_num      = options_to_save.value_num;
                        option.value_str      = options_to_save.value_str;

                        return(db.SaveChanges());
                    }
                    else // add new
                    {
                        db.options.Add(options_to_save);
                        return(db.SaveChanges());
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
                return(0);
            }
        }
示例#4
0
        /// <summary>
        /// 2016-11-30,mxj,add
        /// </summary>
        /// <returns></returns>
        protected override bool ValidateDeleteCustom()
        {
            if (this.grdData.CurrentRow.IsChecked)
            {
                XTemplateBillInfo curr = this.grdData.CurrentRow.DataRow as XTemplateBillInfo;

                DataTable dt  = new DataTable();
                string    sql = "select Rno, Bno from TemplateBill where Rno='" + curr.Rno + "' and Bno='" + curr.Bno + "'";
                dt = SQLHelper.GetDataSet(sql);

                if (dt != null)
                {
                    //XMessageBox.ShowRemindMessage("数据提取异常!");
                    if (dt.Rows.Count <= 1)
                    {
                        if (XMessageBox.ShowQuestion("不存在重复项,是否继续删除!", "提示") == System.Windows.Forms.DialogResult.Yes)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
示例#5
0
 /// <summary>
 /// 菜单单击事件
 /// </summary>
 /// <param name="menuInfo"></param>
 /// <param name="e"></param>
 protected virtual void menuFolderTool_MenuClickEvent(XMenuInfo menuInfo, EventArgs e)
 {
     try
     {
         frmBase frm = Assembly.Load(menuInfo.NameSpace).CreateInstance(menuInfo.FullAssembleName) as frmBase;
         if (frm == null)
         {
             XMessageBox.ShowError("该功能未实现或者实现的接口不正确!");
             return;
         }
         if (menuInfo.IsDialogModel)
         {
             frm.StartPosition = FormStartPosition.CenterParent;
             frm.ShowDialog();
         }
         else
         {
             this.ShowTabbedMdi(frm);
         }
     }
     catch (Exception ex)
     {
         XMessageBox.ShowError(ex.Message);
         XErrorLogTool.WriteLog(ex.ToString());
     }
 }
        private void SetDropdownItem()
        {
            this.cShType._Items.Add(new XDropdownListItem {
                Text = "บุคคลธรรมดา", Value = SHARE_HOLDER_TYPE.P.ToString()
            });
            this.cShType._Items.Add(new XDropdownListItem {
                Text = "นิติบุคคล", Value = SHARE_HOLDER_TYPE.C.ToString()
            });

            string nationality_file_path = AppDomain.CurrentDomain.BaseDirectory + @"Template\nationality.json";

            if (File.Exists(nationality_file_path))
            {
                JsonConvert.DeserializeObject <List <nationality_VM> >(File.ReadAllText(nationality_file_path)).OrderBy(n => n.nationality_code).ToList().ForEach(n =>
                {
                    this.cNationality._Items.Add(new XDropdownListItem {
                        Text = n.nationality_code + " : " + n.nationality_name_th, Value = n
                    });
                });
            }
            else
            {
                XMessageBox.Show("ค้นหาแฟ้ม nationality.json ไม่พบ", "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
                return;
            }
        }
示例#7
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     try
     {
         SaveFileDialog sfd = new SaveFileDialog();
         sfd.Filter = "Excel文件(*.xls)|*.xls";
         if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             this.grdExporter.SheetName = this.Text;
             //this.grdData.RootTable.Columns["select"].Visible = false;
             System.IO.Stream stream = new System.IO.FileStream(sfd.FileName, System.IO.FileMode.CreateNew);
             this.grdExporter.Export(stream);
             stream.Close();
             //this.grdData.RootTable.Columns["select"].Visible = true;
             XMessageBox.ShowRemindMessage("导出完成!");
         }
     }
     catch (Exception ex)
     {
         XErrorLogTool.WriteLog(ex.ToString());
         XMessageBox.ShowError("导出失败!");
     }
     finally
     {
         //this.grdData.RootTable.Columns["select"].Visible = true;
     }
 }
示例#8
0
        /// <summary>
        /// 检查是否有复选框选中的记录
        /// </summary>
        /// <returns></returns>
        protected virtual bool IsDetailSelectedRowByCheckBox()
        {
            int selectedRowsCount = 0;

            m_SelectedDeleteDetailIds = "";
            m_SelectedDetailModels    = new List <XModelBase>();

            foreach (Janus.Windows.GridEX.GridEXRow gridRow in this.grdDetail.GetRows())
            {
                if (gridRow.IsChecked)
                {
                    selectedRowsCount += 1;
                    XModelBase currentModel = gridRow.DataRow as XModelBase;
                    m_SelectedDetailModels.Add(currentModel);
                    string id = currentModel.ID;
                    m_SelectedDeleteDetailIds += "'" + id + "',";
                }
            }
            m_SelectedDeleteDetailIds = m_SelectedDeleteDetailIds.TrimEnd(',');
            if (selectedRowsCount > 0)
            {
                return(true);
            }
            else
            {
                string showMessage = "请选择要删除的明细记录!";
                XMessageBox.ShowRemindMessage(showMessage);
                return(false);
            }
        }
示例#9
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnModify_Click(object sender, EventArgs e)
        {
            string selectrid = GetSelectRow();

            if (!(IsCheck(selectrid)))
            {
                XMessageBox.ShowRemindMessage("请选择记录信息!");
                return;
            }

            DataTable dt  = new DataTable();
            string    sql = "select * from V_EquipmentReceive where rid in(" + selectrid + ")";

            dt = SQLHelper.GetDataSet(sql);

            if (dt == null)
            {
                XMessageBox.ShowRemindMessage("数据提取异常!");
                return;
            }
            if (dt.Rows.Count <= 0)
            {
                XMessageBox.ShowRemindMessage("数据提取异常!");
                return;
            }

            string cust      = "";
            string invoiceno = "";

            if (dt.Rows.Count > 0)
            {
                cust      = dt.Rows[0]["CustName"] + "";
                invoiceno = dt.Rows[0]["InvoiceNo"] + "";

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["InvoiceNo"] + "" == "")
                    {
                        XMessageBox.ShowRemindMessage("所选数据中存在接收单代码为空的!");
                        return;
                    }
                    if (cust != dt.Rows[i]["CustName"] + "")
                    {
                        XMessageBox.ShowRemindMessage("所选数据中单位不一致!");
                        return;
                    }
                    if (invoiceno != dt.Rows[i]["InvoiceNo"] + "")
                    {
                        XMessageBox.ShowRemindMessage("所选数据中接收单代码不一致!");
                        return;
                    }
                }
            }

            frmBillPrint frm = new frmBillPrint("M", selectrid, dt);

            frm.ShowDialog();

            this.Query();
        }
示例#10
0
        /// <summary>
        /// 单号手动录入功能
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void t_tsb_Change_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                TextBlock myBlock = t_tsb_Change.Header as TextBlock;

                if (myBlock.Text == "单号手动录入")
                {
                    //手动生成单号处理
                    myBlock.Text = "单号自动生成";
                    m_IsHand     = true;
                    t_txt_QuotationNo.IsReadOnly = false;
                }
                else
                {
                    myBlock.Text = "单号手动录入";
                    m_IsHand     = false;
                    t_txt_QuotationNo.IsReadOnly = true;
                    t_txt_QuotationNo.Text       = PTBQuotation.Quotation_No;
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
示例#11
0
        public static options GetOptions(this OPTIONS options_key, SccompDbf selected_comp)
        {
            try
            {
                using (LocalDbEntities db = DBX.DataSet(selected_comp))
                {
                    options opt = db.options.Where(o => o.key == options_key.ToString()).FirstOrDefault();

                    if (opt != null)
                    {
                        return(opt);
                    }
                    else
                    {
                        options o = new options {
                            key = options_key.ToString()
                        };
                        db.options.Add(o);
                        db.SaveChanges();
                        return(o);
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
                return(null);
            }
        }
示例#12
0
        private void EditFiles()
        {
            if (this.grdFiles.CurrentRow == null ||
                this.grdFiles.CurrentRow.RowType != Janus.Windows.GridEX.RowType.Record)
            {
                XMessageBox.ShowError("请选择要编辑的记录!");
                return;
            }

            XModelBase currentModel = this.grdFiles.CurrentRow.DataRow as XModelBase;

            XTaskFilesInfo taskFileInfo = currentModel as XTaskFilesInfo;

            if (taskFileInfo.InputUserId != XCommon.LoginUsersInfo.RID)
            {
                XMessageBox.ShowError("不能修改非本人提交的任务文档!");
                return;
            }

            frmTaskFilesEdit frm = new frmTaskFilesEdit(currentModel);

            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.grdFiles.Refresh();
            }
        }
示例#13
0
 /// <summary>
 /// 新建按钮事件
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void t_tsb_New_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (m_IsModify)
         {
             MessageResult myResult = XMessageBox.Ask("当前单据尚未保存,是否继续?", this);
             if (myResult == MessageResult.Yes)
             {
                 //设置新报检单对象
                 CreateNewQuotationModel();
                 //对窗体进行赋值
                 LoadControlsValue();
             }
         }
         else
         {
             //设置新报检单对象
             CreateNewQuotationModel();
             //对窗体进行赋值
             LoadControlsValue();
         }
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
示例#14
0
        private void AddFiles()
        {
            TreeNode selectedNode = this.tvTask.SelectedNode;

            if (!this.IsChildTaskNode(selectedNode))
            {
                XMessageBox.ShowError("请选择要提交文档的子任务!");
                return;
            }

            IList <XModelBase> gridList = this.grdFiles.DataSource as IList <XModelBase>;

            XTaskInfo taskInfo = selectedNode.Tag as XTaskInfo;

            if (taskInfo.AssignPeople != XCommon.LoginUsersInfo.RID)
            {
                XMessageBox.ShowError("当前登录人不是任务负责人,不能提交文档!");
                return;
            }

            frmTaskFilesEdit frm = new frmTaskFilesEdit(gridList, selectedNode);

            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.grdFiles.DataSource = null;
                this.grdFiles.DataSource = frm.ModelList;
                this.grdFiles.Refresh();
            }
        }
示例#15
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                this.query_model = JsonConvert.DeserializeObject <QueryModel>(this.TextArea.Text);

                if (this.query_model != null)
                {
                    DialogReportScope scope = new DialogReportScope(this, this.query_model, this.default_data_path);
                    if (scope.ShowDialog() == DialogResult.OK)
                    {
                        DialogDisplayDataTable dt = new DialogDisplayDataTable(scope.data_table);
                        dt.ShowDialog();
                    }
                }
                else
                {
                    XMessageBox.Show("Syntax error", "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
                return;
            }
        }
示例#16
0
        protected virtual void Import()
        {
            if (!this.ValidateImport())
            {
                return;
            }

            DataTable excelTable = this.grdData.DataSource as DataTable;

            int rowCount = excelTable.Rows.Count;

            m_TimePk = DateTime.Now.ToString("yyyyMMddHHmmss");

            XImportResultInfo resultInfo = this.ImportOperate(excelTable);

            resultInfo.Count = rowCount;
            if (resultInfo.FailureCount > 0)
            {
                int failueCount  = resultInfo.FailureCount;
                int successCount = resultInfo.SuccessCount;

                int notExecCount = resultInfo.Count - successCount - failueCount;

                XMessageBox.ShowRemindMessage("成功导入" + successCount + "条,失败" + failueCount + "条,未执行" + notExecCount + "条!");
                frmOperateResult frm = new frmOperateResult(resultInfo.Results);
                frm.ShowDialog();
            }
            else
            {
                XMessageBox.ShowRemindMessage("成功导入" + rowCount + "条!");
            }
        }
示例#17
0
        //public SQLiteDbPrepare(SccompDbf sccomp) :
        //    base(new SQLiteConnection()
        //    {
        //        ConnectionString = new SQLiteConnectionStringBuilder() { DataSource = sccomp.GetAbsolutePath() + taxonomy_matching_file_name, ForeignKeys = true }.ConnectionString
        //    }, true)
        //{

        //}

        //protected override void OnModelCreating(DbModelBuilder modelBuilder)
        //{
        //    modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        //    base.OnModelCreating(modelBuilder);
        //}

        //public DbSet<boj5_header> boj5_header { get; set; }
        //public DbSet<boj5_person> boj5_person { get; set; }
        //public DbSet<boj5_detail> boj5_detail { get; set; }
        //public DbSet<glacc_match> glacc_match { get; set; }

        public static void EnsureDbCreated(SccompDbf sccomp)
        {
            try
            {
                if (!Directory.Exists(sccomp.GetAbsolutePath()))
                {
                    XMessageBox.Show("ค้นหาไดเร็คทอรี่ " + sccomp.GetAbsolutePath() + " ไม่พบ", "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
                    return;
                }

                if (!File.Exists(sccomp.GetAbsolutePath() + SQLiteDbPrepare.taxonomy_matching_file_name))
                {
                    SQLiteConnection.CreateFile(sccomp.GetAbsolutePath() + SQLiteDbPrepare.taxonomy_matching_file_name);

                    using (SQLiteConnection connection = new SQLiteConnection(@"Data Source=" + sccomp.GetAbsolutePath() + SQLiteDbPrepare.taxonomy_matching_file_name + @";Version=3;"))
                    {
                        using (SQLiteCommand cmd = connection.CreateCommand())
                        {
                            cmd.CommandText = "CREATE TABLE IF NOT EXISTS glacc_match(id INTEGER PRIMARY KEY, accnum TEXT, depcod TEXT, taxodesc TEXT, taxodesc2 TEXT)";

                            connection.Open();
                            cmd.ExecuteNonQuery();
                            connection.Close();
                        }
                    }
                }

                UpgradeDB(sccomp);
            }
            catch (Exception ex)
            {
                XMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
            }
        }
示例#18
0
 /// <summary>
 /// 注销
 /// </summary>
 protected virtual void SignOut()
 {
     if (XMessageBox.ShowQuestion("您确定要注销吗?") == System.Windows.Forms.DialogResult.No)
     {
         return;
     }
     Application.Restart();
 }
示例#19
0
        protected virtual bool ValidateDeleteDetailCommon(object sender)
        {
            if (XMessageBox.ShowQuestion("确定要删除选中的记录吗?") == System.Windows.Forms.DialogResult.No)
            {
                return(false);
            }

            return(true);
        }
示例#20
0
 /// <summary>
 /// 修改前校验
 /// </summary>
 /// <returns></returns>
 protected virtual bool ValidateBeforeEdit()
 {
     if (this.treeView.SelectedNode == null)
     {
         XMessageBox.ShowError("请选择要修改的节点!");
         return(false);
     }
     return(true);
 }
示例#21
0
        public static void ExtractZipFile(string archiveFilenameIn, string password, string outFolder)
        {
            ZipFile zf = null;

            try
            {
                FileStream fs = File.OpenRead(archiveFilenameIn);
                zf = new ZipFile(fs);
                if (!String.IsNullOrEmpty(password))
                {
                    zf.Password = password;     // AES encrypted entries are handled automatically
                }
                foreach (ZipEntry zipEntry in zf)
                {
                    if (!zipEntry.IsFile)
                    {
                        continue;           // Ignore directories
                    }
                    String entryFileName = zipEntry.Name;
                    // to remove the folder from the entry:- entryFileName = Path.GetFileName(entryFileName);
                    // Optionally match entrynames against a selection list here to skip as desired.
                    // The unpacked length is available in the zipEntry.Size property.

                    byte[] buffer    = new byte[4096];  // 4K is optimum
                    Stream zipStream = zf.GetInputStream(zipEntry);

                    // Manipulate the output filename here as desired.
                    String fullZipToPath = Path.Combine(outFolder, entryFileName);
                    string directoryName = Path.GetDirectoryName(fullZipToPath);
                    if (directoryName.Length > 0)
                    {
                        Directory.CreateDirectory(directoryName);
                    }

                    // Unzip file in buffered chunks. This is just as fast as unpacking to a buffer the full size
                    // of the file, but does not waste memory.
                    // The "using" will close the stream even if an exception occurs.
                    using (FileStream streamWriter = File.Create(fullZipToPath))
                    {
                        StreamUtils.Copy(zipStream, streamWriter, buffer);
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
                return;
            }
            finally
            {
                if (zf != null)
                {
                    zf.IsStreamOwner = true; // Makes close also shut the underlying stream
                    zf.Close();              // Ensure we release resources
                }
            }
        }
示例#22
0
 protected virtual bool ValidateAddCommon()
 {
     if (this.grdData.CurrentRow == null || this.grdData.CurrentRow.RowType != Janus.Windows.GridEX.RowType.Record)
     {
         XMessageBox.ShowError("请选择要添加明细的主表记录!");
         return(false);
     }
     return(true);
 }
示例#23
0
 protected override bool ValidataForm()
 {
     if (this.txtPassword.Text.Trim() != this.txtRepass.Text.Trim())
     {
         XMessageBox.ShowError("两次输入的密码不一致!");
         return(false);
     }
     return(true);
 }
示例#24
0
        /// <summary>
        /// 自定义UI校验
        /// </summary>
        /// <returns></returns>
        protected override bool ValidateCustom()
        {
            if (this.m_EditStatus == XEditStatus.AddNew)
            {
                if (this.txtPassWord.Text.Trim() != this.txtRepass.Text.Trim())
                {
                    XMessageBox.ShowError("两次密码输入的不一致!");
                    return(false);
                }
            }

            bool isValidateExist = false;

            if (this.m_EditStatus == XEditStatus.AddNew)
            {
                isValidateExist = true;
            }
            else if (this.m_EditStatus == XEditStatus.Edit)
            {
                if (this.m_OldUserName != this.txtUserName.Text.Trim())
                {
                    isValidateExist = true;
                }
            }

            if (isValidateExist)
            {
                if (this.m_Business.IsExist(this.txtUserName.Text.Trim()))
                {
                    XMessageBox.ShowError("用户名已存在!");
                    return(false);
                }
            }

            bool isValidateRealNameExist = false;

            if (this.m_EditStatus == XEditStatus.AddNew)
            {
                isValidateRealNameExist = true;
            }
            else if (this.m_EditStatus == XEditStatus.Edit)
            {
                if (this.m_OldRealName != this.txtRealName.Text.Trim())
                {
                    isValidateRealNameExist = true;
                }
            }

            if (isValidateRealNameExist && this.m_UsersBusiness.IsRealNameExist(this.txtRealName.Text.Trim()))
            {
                XMessageBox.ShowError("真实姓名已存在!");
                return(false);
            }

            return(true);
        }
示例#25
0
        public bool InsertCustom(XModelBase model)
        {
            DbConnection  sqlConn = this.m_DataAccess.Connection;
            DbTransaction trans   = null;

            try
            {
                if (sqlConn.State == ConnectionState.Closed)
                {
                    sqlConn.Open();
                }

                trans = sqlConn.BeginTransaction();

                string sql = this.GetInsertSql(model) + ";";

                XVTaskFilesInfo taskFilesInfo = model as XVTaskFilesInfo;

                //更新任务状态为结束
                sql += "UPDATE Task SET TaskStatus='结束' WHERE RID='" + taskFilesInfo.MainId + "';";

                if (taskFilesInfo.FileFullName != string.Empty)
                {
                    //上传附件
                    DbCommand fileCommand = this.GetFileCommand(taskFilesInfo);
                    fileCommand.Connection  = sqlConn;
                    fileCommand.Transaction = trans;
                    DbDataReader reader = fileCommand.ExecuteReader();
                    reader.Close();
                }

                DbCommand cmd = this.m_DataAccess.GetDbCommand();
                cmd.Connection  = sqlConn;
                cmd.CommandText = sql;
                cmd.Transaction = trans;
                bool isSuccess = cmd.ExecuteNonQuery() > 0;
                trans.Commit();

                return(isSuccess);
            }
            catch (Exception ex)
            {
                XMessageBox.ShowError(ex.Message);
                XErrorLogTool.WriteLog(ex.ToString());
                trans.Rollback();
            }
            finally
            {
                if (sqlConn.State == ConnectionState.Open)
                {
                    sqlConn.Close();
                }
            }

            return(false);
        }
示例#26
0
        protected override bool ValidateEditCustom()
        {
            if (this.m_Business.IsCheck(this.m_CurrentModel))
            {
                XMessageBox.ShowError("要修改的记录已审核,不能修改!");
                return(false);
            }

            return(true);
        }
示例#27
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     if (XMessageBox.Show("ยกเลิกการแก้ไขข้อมูล, ทำต่อหรือไม่?", "", MessageBoxButtons.OKCancel, XMessageBoxIcon.Question) == DialogResult.OK)
     {
         this.tmp_boj5_header = null;
         this.GetBojData();
         this.FillForm(this.boj5_header, this.boj5_detail);
         this.ResetFormState(FORM_MODE.READ);
     }
 }
示例#28
0
        protected virtual bool ValidateImportCommon()
        {
            if (this.grdData.RowCount == 0)
            {
                XMessageBox.ShowError("没有要导入的记录!");
                return(false);
            }

            return(true);
        }
示例#29
0
        public static bool Preview(string fileId)
        {
            string where = " and FileId='" + fileId + "'";

            IList <XModelBase> fileAttachInfos = m_FileAttachBusiness.QueryByWhere(where);

            if (fileAttachInfos.Count == 0)
            {
                XMessageBox.ShowError("未找到附件,无法预览!");
                return(false);
            }

            XFileAttachmentInfo fileInfo = fileAttachInfos[0] as XFileAttachmentInfo;

            string[] imageTypes  = new string[] { ".png", ".jpg", ".jpeg" };
            string[] officeTypes = new string[] { ".doc", ".docx", ".xls", ".xlsx" };

            if (!imageTypes.Contains(fileInfo.AtchType) &&
                !officeTypes.Contains(fileInfo.AtchType))
            {
                XMessageBox.ShowError("不支持预览格式为[" + fileInfo.AtchType + "]的文件!");
                return(false);
            }

            string path     = XCommon.TempPath;
            string fileName = Guid.NewGuid().ToString();

            fileName = m_FileAttachBusiness.DownLoadFile(fileId, path, fileName);

            if (imageTypes.Contains(fileInfo.AtchType))
            {
                //如果是图片
                frmImagePreview frm = new frmImagePreview(fileName);
                frm.ShowDialog();
            }
            else
            {
                frmOfficeFilePreview frm = new frmOfficeFilePreview(fileName);
                frm.ShowDialog();
            }

            if (File.Exists(fileName))
            {
                try
                {
                    File.Delete(fileName);
                }
                catch (Exception ex)
                {
                    XErrorLogTool.WriteLog(ex.ToString());
                }
            }

            return(true);
        }
示例#30
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDel_Click(object sender, EventArgs e)
        {
            string selectrid = GetSelectRow();

            if (!(IsCheck(selectrid)))
            {
                XMessageBox.ShowRemindMessage("请选择记录信息!");
                return;
            }
            DataTable dt  = new DataTable();
            string    sql = "select * from V_EquipmentReceive where rid in(" + selectrid + ")";

            dt = SQLHelper.GetDataSet(sql);

            if (dt == null)
            {
                XMessageBox.ShowRemindMessage("数据提取异常!");
                return;
            }
            if (dt.Rows.Count <= 0)
            {
                XMessageBox.ShowRemindMessage("数据提取异常!");
                return;
            }
            if (dt.Rows.Count > 1)
            {
                XMessageBox.ShowRemindMessage("请选择一条数据!");
                return;
            }
            string invoiceno = dt.Rows[0]["InvoiceNo"] + "";

            if (invoiceno == "")
            {
                XMessageBox.ShowRemindMessage("所选数据未打印接收单!");
                return;
            }

            if (MessageBox.Show("是否删除接收单号为:" + invoiceno + "的接收单信息?", "提醒!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
            {
                string sqldel    = "delete from TemplateBill where Rno='" + invoiceno + "'";
                string sqlupdate = "update EquipmentReceive set InvoiceNo='' where InvoiceNo='" + invoiceno + "'";

                if (SQLHelper.ExecuteCommand(sqldel) > 0)
                {
                    if (SQLHelper.ExecuteCommand(sqlupdate) > 0)
                    {
                        XMessageBox.ShowRemindMessage("执行成功!");
                    }
                }
            }



            this.Query();
        }