Esempio n. 1
0
        private void btnDcExcel_Click(object sender, EventArgs e)
        {
            SaveFileDialog sDialog = new SaveFileDialog();

            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == -1)
            {
                sDialog.FileName = "编号:" + sID + "交通事故详情" + ".xls";
            }

            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 1)
            {
                sDialog.FileName = "编号:" + sID + "交通事故痕迹检验详情" + ".xls";
            }
            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 2)
            {
                sDialog.FileName = "编号:" + sID + "交通事故酒精检验详情" + ".xls";
            }
            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 3)
            {
                sDialog.FileName = "编号:" + sID + "交通事故尸体检验详情" + ".xls";
            }

            if (sDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
                grd.ExportToXls(sDialog.FileName, options);
                DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        private void getSum()
        {
            string sError = "";
            string strSql = "";

            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == -1)
            {
                strSql = $"select BaoSum from T_AnQing where AnQingNo={sID} ";
            }

            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 1)
            {
                strSql = $"select BaOSumA from T_AnQing where AnQingNo={sID} ";
            }
            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 2)
            {
                strSql = $"select BaOSumB from T_AnQing where AnQingNo={sID} ";
            }
            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 3)
            {
                strSql = $"select BaOSumD from T_AnQing where AnQingNo={sID} ";
            }

            DataTable dt12 = SqlHelper.RunQuery(CommandType.Text, strSql, null, out sError);

            sum = Convert.ToInt32(dt12.Rows[0][0]);

            this.label2.Text = sum.ToString();;
        }
Esempio n. 3
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            string sCon = "";

            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == -1)
            {
                sCon += "  set BaOSum";
            }

            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 1)
            {
                sCon += "  set BaOSumA";
            }
            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 2)
            {
                sCon += "  set BaOSumB";
            }
            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 3)
            {
                sCon += "  set BaOSumD";
            }


            MessageBox.Show("(请保证输入正确)确定要使用打包价吗?", "提示", MessageBoxButtons.YesNo);
            string sError = "";
            string strSql = $"update T_AnQing {sCon}={this.txtBao.Text.Trim()} where AnQingNo={sID}";
            int    ok     = SqlHelper.ExecuteNonQuery(CommandType.Text, strSql, null, out sError);

            if (ok > 0)
            {
                MessageBox.Show("已启用打包价。");
            }
        }
Esempio n. 4
0
        private void btn_cx_Click(object sender, EventArgs e)
        {
            getSum();
            string sCon  = "";
            string ssCon = "";

            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == -1)
            {
                ssCon += "aq.BaoSum";
            }
            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 1)
            {
                sCon += "  and ax.BaoType_Id=1 ";

                ssCon += "aq.BaOSumA";
            }
            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 2)
            {
                sCon  += "  and ax.BaoType_Id=2 ";
                ssCon += "aq.BaOSumB";
            }
            if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 3)
            {
                sCon  += "  and ax.BaoType_Id=3 ";
                ssCon += "aq.BaOSumD";
            }



            string        sError  = "";
            StringBuilder strSql1 = new StringBuilder();

            strSql1 = new StringBuilder();
            strSql1.Append(" select AnQingXiang_ID,XiangBaoJia,ax.AnQingId,Bao_Desc,XiangMuName,XiangMuCount,GongSiName,ax.XiangMuId, " + ssCon + "  from T_AnQingXiang ax ");
            strSql1.Append(" join T_XiangMu xm on ax.XiangMuId=xm.XiangMuID");
            strSql1.Append(" join T_BaoType bt on ax.BaoType_Id=bt.Bao_TypeId");
            strSql1.Append(" join T_GongSi gs on ax.GongSiID=gs.GongSiId");
            strSql1.Append(" join T_AnQing aq on ax.AnQingId=aq.AnQingNo");
            strSql1.Append(" where ax.AnQingId=" + sID + sCon + " order by xm.XiangMuID");

            DataTable dt = SqlHelper.RunQuery(CommandType.Text, strSql1.ToString(), null, out sError);

            this.grd.DataSource = dt;
        }
Esempio n. 5
0
        //确定
        private void btnOK_Click(object sender, EventArgs e)
        {
            string sError = ""; 

            string sDeptID = this.lookUpEdit1.EditValue.ToString();
            string sOperID = this.lookUpEdit2.EditValue.ToString();
            string sPwd = this.txtPwd.Text.Trim();

            string strSql = "select TQx_Oper.*,TQx_Dept.ErBaoTiXingDay,TQx_Dept.NianJianTiXingDay from TQx_Oper "
                        + " left join TQx_Dept on TQx_Dept.DeptID=TQx_Oper.DeptID WHERE TQx_Oper.DeptID='" + sDeptID + "' AND  OperID='" + sOperID + "' AND OperPwd='" + sPwd + "' ";
            DataTable dt = SqlHelper.RunQuery(CommandType.Text, strSql, null, out sError);


            if (dt != null && dt.Rows.Count > 0)
            {
                Program.sDeptID = dt.Rows[0]["DeptID"].ToString();
                Program.sDeptName = dt.Rows[0]["DeptName"].ToString();
                Program.sOperID = dt.Rows[0]["OperID"].ToString();
                Program.sOperName = dt.Rows[0]["OperName"].ToString();
                Program.sRoleID = dt.Rows[0]["RoleID"].ToString();             
                Program.SOperPwd = dt.Rows[0]["OperPwd"].ToString();

                Program.iErBaoTiXingDay = CommonInfo.CLng(dt.Rows[0]["ErBaoTiXingDay"].ToString());
                Program.iNianJianTiXingDay = CommonInfo.CLng(dt.Rows[0]["NianJianTiXingDay"].ToString());
                MessageBox.Show("欢迎【" + Program.sDeptName + "】的【" + Program.sOperName + "】您进去本系统!", "提示");
                try
                {
                    Program.UpdateConfig("LoginDept", this.lookUpEdit1.EditValue.ToString());
                }
                catch { }
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                
            }
            else   
            {
                MessageBox.Show("用户名或密码错误,请重新输入!", "提示");
                return;
            }

        }
Esempio n. 6
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            getSum();


            try
            {
                string sError = "";


                DataSet ds = new DataSet();//创建数据集

                string    sql = $"select * from T_AnQing where AnQingNo={sID}";
                DataTable tb  = SqlHelper.RunQuery(CommandType.Text, sql, null, out sError);
                DataTable tb2 = (DataTable)grd.DataSource;

                tb.TableName = "dt1n";
                ds.Tables.Add(tb2.Copy());
                tb2.TableName = "dt2n";
                ds.Tables.Add(tb.Copy());

                XtraReport report = new XtraReport();

                report.LoadLayout(Application.StartupPath + "/Print/AnQingXX.repx");

                report.DataSource = ds;
                // report.PageHeight = 320 + 18 * dt.Rows.Count;
                //添加参数
                report.Parameters.Clear();


                DevExpress.XtraReports.Parameters.Parameter p2 = new DevExpress.XtraReports.Parameters.Parameter();
                p2.Name        = "标题";
                p2.Description = "标题";

                if (CommonInfo.CLng(this.cmbDeptID.EditValue) == -1)
                {
                    p2.Value = "案情编号:" + sID + " 交通事故详情";
                }

                if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 1)
                {
                    p2.Value = "案情编号:" + sID + " 交通事故痕迹检验详情";
                }
                if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 2)
                {
                    p2.Value = "案情编号:" + sID + " 交通事故酒精检验详情";
                }
                if (CommonInfo.CLng(this.cmbDeptID.EditValue) == 3)
                {
                    p2.Value = "案情编号:" + sID + " 交通事故尸体检验详情";
                }



                report.Parameters.Add(p2);


                DevExpress.XtraReports.Parameters.Parameter p3_1 = new DevExpress.XtraReports.Parameters.Parameter();
                p3_1.Name        = "统计";
                p3_1.Description = "统计";
                p3_1.Value       = gridColumn4.SummaryText;;;;
                report.Parameters.Add(p3_1);

                DevExpress.XtraReports.Parameters.Parameter p3_2 = new DevExpress.XtraReports.Parameters.Parameter();
                p3_2.Name        = "打包价";
                p3_2.Description = "打包价";
                if (sum == 0)
                {
                    p3_2.Value = " " + gridColumn4.SummaryText;
                }
                else
                {
                    p3_2.Value = " " + sum;
                }

                report.Parameters.Add(p3_2);

                DevExpress.XtraReports.Parameters.Parameter p3_3 = new DevExpress.XtraReports.Parameters.Parameter();
                p3_3.Name        = "状态";
                p3_3.Description = "状态";
                p3_3.Value       = ja;
                report.Parameters.Add(p3_3);



                if (Program.sOperID != "admin")
                {
                    report.Print();
                }
                else
                {
                    report.ShowDesignerDialog();
                }
            }
            catch { }
        }
Esempio n. 7
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            try
            {
                if (Program.sOperID.Trim() == "admin")
                {
                    barQx.Enabled = true;
                    brahw.Enabled = true;
                }
                else
                {
                    barQx.Enabled = false;
                    brahw.Enabled = false;
                }
                barInfo.Caption = "部门:" + Program.sDeptName + "        登陆人:" + Program.sOperID + " | " + Program.sOperName;
                try
                {
                    this.treeView1.Nodes[0].Expand();
                    this.treeView1.Nodes[3].Expand();
                }
                catch { }


                Form1 childForm = new Form1();
                childForm.MdiParent = this;
                childForm.Text      = "我的桌面";
                childForm.Show();


                string sError = "";
                string sql    = $"select AnQingDate,insDate from T_AnQing where DeftName='{ Program.sDeptName}' and OperName='{Program.sOperName}' and State='进行中'";

                string    sumdate  = "";
                string    _sumdate = "";
                DataTable tbDate   = SqlHelper.RunQuery(CommandType.Text, sql, null, out sError);
                if (tbDate.Rows.Count != 0)
                {
                    int cha = 0;
                    for (int i = 0; i < tbDate.Rows.Count; i++)
                    {
                        cha = CommonInfo.DateDiff(Convert.ToDateTime(tbDate.Rows[i]["insDate"]), DateTime.Now);

                        if (cha >= 20)
                        {
                            sumdate = Convert.ToDateTime(tbDate.Rows[i]["AnQingDate"]).ToString("M月");

                            if (sumdate != _sumdate)
                            {
                                MessageBox.Show(sumdate + "有正在进行中的检测项以超过20天,请尽快处理!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                _sumdate = sumdate;
                            }
                        }
                    }
                }

                if (Program.sRoleID == "003")
                {
                    FrmBaoFeiEdit bf = new FrmBaoFeiEdit();
                    bf.ShowDialog();
                }

                //菜单权限读取
                string    sRoleID = Program.sRoleID;
                string    strSql  = "SELECT *,TQx_Menu.TreeNodeName FROM TQx_RoleQx left join TQx_Menu on TQx_Menu.MenuID=TQx_RoleQx.MenuID  WHERE IsQx=1 and TQx_Menu.TreeNodeName<>'' and  RoleID='" + sRoleID + "' order by TQx_Menu.SortID ";
                DataTable dtQx    = SqlHelper.RunQuery(CommandType.Text, strSql, null, out sError);


                if (Program.sOperID.Trim() != "admin")
                {
                    LoadTreeViewQx(treeView1.Nodes[0], dtQx.DefaultView, CommonInfo.CLng(treeView1.Nodes[0].Tag));
                    LoadTreeViewQx(treeView1.Nodes[1], dtQx.DefaultView, CommonInfo.CLng(treeView1.Nodes[1].Tag));
                }
                else
                {
                    //treeView1.Nodes.Clear();
                }
            }
            catch { }

            try
            {
                string    sError = "";
                string    strSql = "select * from T_BanBen where 1=1";
                DataTable dtInit = SqlHelper.RunQuery(CommandType.Text, strSql, null, out sError);

                barButtonItem9.Caption = dtInit.Rows[0]["BanBenDesc"].ToString();
                if (dtInit.Rows[0]["BanBenDesc"].ToString().Trim() != Program.sVersion)
                {
                    MessageBox.Show("您的当前版本不是最新版本,请更新到最新版本[" + dtInit.Rows[0]["BanBenDesc"].ToString().Trim() + "]!", "提示");
                    this.Close();
                }
            }
            catch { barButtonItem9.Caption = "       "; }
        }
Esempio n. 8
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            string sError = "";
            string ID, RoleID, RoleName, SortID, State;

            ID       = sID;
            RoleID   = this.txtRoleID.Text.Trim();
            RoleName = this.txtRoleName.Text.Trim();
            SortID   = CommonInfo.CLng(this.txtSortID.Text.Trim()).ToString();
            State    = this.cmbState.Text.Trim();
            StringBuilder strSql = new StringBuilder();

            if (sID.Trim() == "")
            {
                strSql = new StringBuilder();
                strSql.Append("insert into TQx_Role(");
                strSql.Append("RoleID,RoleName,SortID,State)");
                strSql.Append(" values (");
                strSql.Append("@RoleID,@RoleName,@SortID,@State)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@RoleID",   SqlDbType.VarChar, 50),
                    new SqlParameter("@RoleName", SqlDbType.VarChar, 50),
                    new SqlParameter("@SortID",   SqlDbType.Int,      4),
                    new SqlParameter("@State",    SqlDbType.VarChar, 50)
                };
                parameters[0].Value = RoleID;
                parameters[1].Value = RoleName;
                parameters[2].Value = SortID;
                parameters[3].Value = State;
                SqlHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters, out sError);
                if (sError.Trim() != "")
                {
                    MessageBox.Show("保存失败,错误:" + sError, "提示");
                    return;
                }
                //清空
                this.toolQingKong_Click(null, null);
            }
            else
            {
                strSql = new StringBuilder();
                strSql.Append("update TQx_Role set ");
                strSql.Append("RoleName=@RoleName,");
                strSql.Append("SortID=@SortID,");
                strSql.Append("State=@State");
                strSql.Append(" where ID=@ID");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@RoleName", SqlDbType.VarChar, 50),
                    new SqlParameter("@SortID",   SqlDbType.Int,      4),
                    new SqlParameter("@State",    SqlDbType.VarChar, 50),
                    new SqlParameter("@ID",       SqlDbType.BigInt, 8)
                };
                parameters[0].Value = RoleName;
                parameters[1].Value = SortID;
                parameters[2].Value = State;
                parameters[3].Value = ID;
                SqlHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters, out sError);
                if (sError.Trim() != "")
                {
                    MessageBox.Show("保存失败,错误:" + sError, "提示");
                    return;
                }
                this.Close();
            }
        }