Esempio n. 1
0
 /// <summary>
 /// 退出系统
 /// </summary>
 public void Closed()
 {
     try
     {
         if ("0" == Function.ComForm.DspMsg("Q001", ""))
         {
             // 删除登录信息
             WinMenuPro fr = (WinMenuPro)Application.OpenForms["WinMenuPro"];
             if (fr != null)
             {
                 fr.Close();
             }
             this.Close();
             Application.Exit();
         }
         else
         {
             return;
         }
     }
     catch (Exception ex)
     {
         ComForm.DspMsg("E001", "");
         //MessageBox.Show("系统出现问题,请与管理员联系!");
         return;
     }
 }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                //验证所添加的是不是全为空(2012/11/02)
                if ((string.IsNullOrEmpty(this.txtPass.Text.Trim()) == true
                     ||
                     string.IsNullOrEmpty(this.txtPass_YZ.Text.Trim()) == true
                     )
                    ||

                    this.txtPass_YZ.Text.Trim().Equals(this.txtPass.Text.Trim()) == false
                    )
                {
                    ComForm.DspMsg("W103", "");
                    return;
                }
                //验证用户名是否存在
                else
                {
                    BLL.fmd020 bllfmd020 = new BLL.fmd020();
                    bllfmd020.Update_Pass(txtPass.Text.Trim().Replace("'", ""), ComForm.strUserName);
                    ComForm.DspMsg("M002", "");
                }
            }
            catch (Exception ex)
            {
                Comm.InsertErrLog(ex.ToString(), this.Name);
                ComForm.DspMsg("E013", "");
            }
        }
Esempio n. 3
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            ////Application.Run(new BllTest());
            //Application.Run(new WinLogin());


            try
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionEventHandler);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Process[] myProcesses = Process.GetProcessesByName(Application.ProductName);
                if (myProcesses.Length <= 1)
                {
                    //Application.Run(new testForm("2015/01/29", "BSC070", "","HL_BSC070_150128_01", "", "", "", ""));

                    Application.Run(new WinLogin());
                }
                else
                {
                    ComForm.DspMsg("E002", "");
                }
                Application.Exit();
            }
            catch (Exception ex)
            {
                ComForm.DspMsg("E001", "");
                ComForm.InsertErrLog(ex.Message, "LOGIN");
            }
        }
Esempio n. 4
0
 public void SetListView(string strNO, ListView lv)
 {
     try
     {
         lv.Items.Clear();
         DataTable dt = _projectbll.GetProject_Name(strNO);//, ComForm.strUserName
         if (dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 //   设置行高   20
                 ImageList imgList = new ImageList();
                 imgList.ImageSize = new Size(20, 20); //分别是宽和高
                 lv.SmallImageList = imgList;          //这里设置listView的SmallImageList ,用imgList将其撑大
                 lv.SmallImageList = imageList1;
                 lv.Items.Add(dt.Rows[i]["Name"].ToString(), 2);
             }
         }
         dt.Clear();
     }
     catch (Exception ex)
     {
         ComForm.DspMsg("E001", "");
         //MessageBox.Show("系统出现问题,请与管理员联系!");
         return;
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 显现窗体函数 listView1
        /// </summary>
        private void ListViewSelect(string FromName)
        {
            try
            {
                string strForm  = string.Empty;
                Form   showForm = null;

                // 获取程序名称(英文)
                DataTable dt = _projectbll.GetP_PorName(FromName.Trim());
                if (0 < dt.Rows.Count)
                {
                    string P_PorName = dt.Rows[0]["P_PorName"].ToString();
                    showForm = (Form)System.Reflection.Assembly.Load("TianMaSystem").CreateInstance("TianMaSystem." + P_PorName);
                }
                dt.Clear();

                strForm = showForm.Name;
                Form fr = Application.OpenForms[strForm];
                if (fr != null)
                {
                    fr.BringToFront();
                }
                else
                {
                    showForm.MdiParent     = this;
                    showForm.StartPosition = FormStartPosition.Manual;
                    showForm.Show();
                }
            }
            catch (Exception ex)
            {
                ComForm.DspMsg("W002", "");
                //ComForm.InsertErrLog(ex.ToString(), this.Name.ToString());
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 初始化设置
        /// </summary>
        public void SetLoad()
        {
            try
            {
                ShowLRHM();

                DateLab.Text = PublicFun.GetSystemDateTime(ComConst.Date, "yyyy/MM/dd");

                //// 获取社员名字
                //DataTable dt = _menuprobll.GetSymc(Const.SYBH);
                //if (0 < dt.Rows.Count)
                //{
                //    LabSybh.Text = dt.Rows[0][0].ToString();
                //}
                //else
                //{
                //    LabSybh.Text = Const.SYBH;
                //}
                //dt.Clear();

                LabSybh.Text = "您好," + ComForm.strSymc + "( " + Const.SYBH + " )";
                btn01.Focus();
            }
            catch (Exception ex)
            {
                ComForm.DspMsg("E001", "");
                //MessageBox.Show("系统出现问题,请与管理员联系!");
                return;
            }
        }
Esempio n. 7
0
        // 验证用户名是否存在
        private void txtUserName_Validating(object sender, CancelEventArgs e)
        {
            if (btnFromClosed.Focused)
            {
                return;
            }
            if (txtUserName.Text.ToString().Trim() != string.Empty)
            {
                this.txtUserName.Text = txtUserName.Text.ToString().PadLeft(5, '0');
            }
            else
            {
                UserNameLab.Text = string.Empty;
            }

            string UserNameck = Function.ComForm.strUserName = txtUserName.Text.Trim().Replace("'", "");

            if (UserNameck != string.Empty)
            {
                DataTable dt = _bllfmd020.YongHuMima_GetCorN(ComForm.strUserName);
                if (dt.Rows.Count > 0)
                {
                    this.txtUserName.Text = dt.Rows[0]["UserName"].ToString();
                    this.UserNameLab.Text = dt.Rows[0]["XM"].ToString();
                }
                else
                {
                    this.txtUserName.Text = UserNameLab.Text = string.Empty;
                    ComForm.DspMsg("W034", "");
                    txtUserName.Focus();
                    return;
                }
                dt.Clear();
            }
        }
Esempio n. 8
0
 private void btnExit_Click(object sender, EventArgs e)
 {
     if (ComConst.LING == ComForm.DspMsg("Q001", ""))
     {
         System.GC.Collect();
         this.Close();
     }
 }
Esempio n. 9
0
 //退出按钮
 private void btnClose_Click(object sender, EventArgs e)
 {
     if (ComConst.LING == ComForm.DspMsg("Q001", ""))
     {
         System.GC.Collect();
         this.Close();
     }
     else
     {
         cboGlMc.Focus();
     }
 }
Esempio n. 10
0
 //退出按钮
 private void btnClose()
 {
     if (ComConst.LING == ComForm.DspMsg("Q001", ""))
     {
         System.GC.Collect();
         this.Close();
     }
     else
     {
         return;
     }
 }
Esempio n. 11
0
 private void Menu1_Button(object sender, EventArgs e)
 {
     try
     {
         GetShowListView(sender);
     }
     catch (Exception ex)
     {
         ComForm.DspMsg("E001", "");
         //MessageBox.Show("系统出现问题,请与管理员联系!");
         return;
     }
 }
Esempio n. 12
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            //btn_Login.Text = "正在登录...";
            //Application.DoEvents();
            string UserName = Function.ComForm.strUserName = txtUserName.Text.Trim().ToLower().Replace("'", "");

            ComForm.strSymc = UserNameLab.Text.Trim();
            string PassWord = txtPass.Text.Trim().Replace("'", "");

            Function.Const.SYBH = ComForm.strUserName;
            if (UserName == string.Empty)
            {
                ComForm.DspMsg("W001", "");
                this.txtUserName.Focus();
                return;
            }
            if (PassWord == string.Empty)
            {
                ComForm.DspMsg("W005", "");
                this.txtPass.Focus();
                return;
            }
            if (CheckUserPass(UserName, PassWord))
            {
                // 管理员权限登录,打开FirstPage菜单
                WinMenuPro fr = (WinMenuPro)Application.OpenForms["WinMenuPro"];
                if (fr != null)
                {
                    fr.Close();
                    WinMenuPro Main = new WinMenuPro();
                    Main.Show();
                }
                else
                {
                    WinMenuPro Main = new WinMenuPro();
                    Main.Show();
                }
                this.txtUserName.Focus();
                this.Hide();
                //btn_Login.Text = "登  录";
                ClearItems();
            }
            else
            {
                ComForm.DspMsg("W101", "");
                this.txtPass.Focus();
                return;
            }
        }
Esempio n. 13
0
 //清空按钮
 private void btnClear_Click(object sender, EventArgs e)
 {
     if (ComConst.LING == ComForm.DspMsg("Q002", ""))
     {
         cboGlMc.Text  = string.Empty;
         txtMcKey.Text = string.Empty;
         txtSxMc.Text  = string.Empty;
         txtZsMc.Text  = string.Empty;
         fspdMc.ActiveSheet.Rows.Count = 0;
         cboGlMc.Focus();
     }
     else
     {
         cboGlMc.Focus();
     }
 }
Esempio n. 14
0
 //清空按钮
 private void btnClear_Click(object sender, EventArgs e)
 {
     if (ComConst.LING == ComForm.DspMsg("Q002", ""))
     {
         // cboGlMc.Text = string.Empty;
         txtDZ.Text      = string.Empty;
         txtGYSSLMC.Text = string.Empty;
         txtGYSMC.Text   = string.Empty;
         // fspdMc.ActiveSheet.Rows.Count = 0;
         // cboGlMc.Focus();
         fillSPD();
     }
     else
     {
         //cboGlMc.Focus();
         txtGYSMC.Focus();
     }
 }
Esempio n. 15
0
        //删除按钮
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (cboGlMc.Text.strReplace().IsNullOrEmpty())
            {
                ComForm.DspMsg("W002", "管理名称");
                cboGlMc.Focus();
                return;
            }

            if (lblID.Text.IsNullOrEmpty())
            {
                ComForm.DspMsg("W063", "");
                cboGlMc.Focus();
                return;
            }

            if (Const.LING == ComForm.DspMsg("Q003", ""))
            {
                try
                {
                    _modelFMD000.ID = lblID.Text.StringToInt();
                    if (DbHelperMySql.ExecuteSql(DBHelper.Del(TableName, " and ID=" + _modelFMD000.ID + "")) != -1)
                    {
                        ComForm.DspMsg("M001", "");
                        lblID.Text = string.Empty;
                    }
                    else
                    {
                        ComForm.DspMsg("E001", "");
                    }
                    cboGlMc.Focus();
                }
                catch (Exception ew)
                {
                    ComForm.DspMsg("E001", "");
                    return;
                }
                txtMcKey.Text = string.Empty;
                txtSxMc.Text  = string.Empty;
                txtZsMc.Text  = string.Empty;
                fillSPD();
            }
        }
Esempio n. 16
0
        //保存按钮
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cboGlMc.Text.strReplace().IsNullOrEmpty())
            {
                ComForm.DspMsg("W002", "管理名称");
                cboGlMc.Focus();
                return;
            }
            if (txtMcKey.Text.strReplace().IsNullOrEmpty())
            {
                ComForm.DspMsg("W002", "名称KEY");
                txtMcKey.Focus();
                return;
            }
            if (txtZsMc.Text.strReplace().IsNullOrEmpty())
            {
                ComForm.DspMsg("W002", "正式名称");
                txtZsMc.Focus();
                return;
            }

            if (ComConst.LING == ComForm.DspMsg("Q004", ""))
            {
                try
                {
                    List <string> lisSql = new List <string>();
                    _modelFMD000.GLBH = cboGlMc.getValue() + txtMcKey.Text.strReplace();
                    _modelFMD000.ZSMC = txtZsMc.Text.strReplace();
                    _modelFMD000.SLMC = txtSxMc.Text.strReplace();
                    if (_bllFMD000.Exists(_modelFMD000.GLBH))
                    {
                        lisSql.Add(DBHelper.Del(TableName, "and GLBH='" + _modelFMD000.GLBH + "'"));
                    }
                    //插入数据
                    _modelFMD000.RLZBH = ComForm.strUserName;
                    _modelFMD000.RLR   = PublicFun.GetSystemDateTime(Const.Date, Const.dateStyle_YMD);
                    _modelFMD000.RLSJ  = PublicFun.GetSystemDateTime(Const.Time, string.Empty);
                    _modelFMD000.RLDMM = systemdate.Get_SysDNBH();
                    lisSql.Add(DBHelper.Add(TableName, _modelFMD000));
                    if (DbHelperMySql.ExecuteSqlTran(lisSql) != -1)
                    {
                        ComForm.DspMsg("M002", "");
                    }
                    else
                    {
                        ComForm.DspMsg("E001", "");
                        ComForm.InsertErrLog("数据插入失败!", this.Name);
                    }
                    cboGlMc.Focus();
                }
                catch (Exception ew)
                {
                    ComForm.DspMsg("E001", "");
                    ComForm.InsertErrLog(ew.ToString(), this.Name);
                    return;
                }
                txtMcKey.Text = string.Empty;
                txtZsMc.Text  = string.Empty;
                txtSxMc.Text  = string.Empty;
                fillSPD();
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 显示文档函数:把帮助文档从服务器上下载到本地机器,在打开文档。
        /// </summary>
        private void ListViewSelectWd(string FromName)
        {
            try
            {
                // 服务器路径
                string SourcePath = System.Configuration.ConfigurationSettings.AppSettings["SourcePath"].ToString();

                // 【考勤明细录入】文件名
                string strKaoQin = System.Configuration.ConfigurationSettings.AppSettings["KaoQin"].ToString();

                // 【工资】文件名
                string strGongZi = System.Configuration.ConfigurationSettings.AppSettings["GongZi"].ToString();

                // 【帮助】文件名
                string strHelp = System.Configuration.ConfigurationSettings.AppSettings["Help"].ToString();

                switch (FromName)
                {
                case "考勤入力用例":
                    SourcePath = SourcePath + "\\" + strKaoQin;
                    // 打开服务器文件
                    System.Diagnostics.Process.Start(SourcePath);
                    break;

                case "工资计算用例":
                    SourcePath = SourcePath + "\\" + strGongZi;
                    // 打开服务器文件
                    System.Diagnostics.Process.Start(SourcePath);
                    break;

                case "使用说明书":
                    SourcePath = SourcePath + "\\" + strHelp;
                    // 目标路径
                    string TargetPath = System.Configuration.ConfigurationSettings.AppSettings["TargetPath"].ToString();

                    // 帮助文档是否覆盖,true覆盖,false不覆盖
                    bool Isrewrite = true;

                    if (!System.IO.File.Exists(TargetPath + strHelp))
                    {
                        if (!System.IO.Directory.Exists(TargetPath))
                        {
                            System.IO.Directory.CreateDirectory(TargetPath);
                        }

                        // 获取服务器文档的扩展名(Extension)如:.txt - .xls - .pdf等等
                        string strExten = Path.GetExtension(SourcePath);

                        // 从服务器拷贝到本地
                        System.IO.File.Copy(SourcePath, TargetPath + strHelp, Isrewrite);

                        //// 打开本地文件
                        System.Diagnostics.Process.Start(TargetPath + strHelp);
                    }
                    else
                    {
                        //// 打开本地文件
                        System.Diagnostics.Process.Start(TargetPath + strHelp);
                    }

                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                ComForm.DspMsg("W002", "");
                //ComForm.InsertErrLog(ex.ToString(), this.Name.ToString());
            }
        }
Esempio n. 18
0
        //删除按钮
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //if (cboGlMc.Text.strReplace().IsNullOrEmpty())
            //{
            //    ComForm.DspMsg("W002", "管理名称");
            //    cboGlMc.Focus();
            //    return;
            //}
            if (txtDZ.Text.strReplace().IsNullOrEmpty())
            {
                ComForm.DspMsg("W002", "客户编号");
                txtDZ.Focus();
                return;
            }

            //判断名称KEY 是否存在
            bool chkMckey = false;

            for (int i = 0; i < fspdMc.ActiveSheet.Rows.Count; i++)
            {
                if (txtDZ.Text.Equals(ComSpread.SpdGetValue(fspdMc, i, 0)))
                {
                    chkMckey = true;
                    break;
                }
            }
            //判断名称KEY 是否存在,不存在不做删除操作
            //if (chkMckey == false)
            //{
            //    ComForm.DspMsg("W063", "客户编号");

            //    txtDZ.Focus();
            //    return;
            //}


            //chkMckey = false;
            //for (int i = 0; i < fspdMc.ActiveSheet.Rows.Count; i++)
            //{
            //    if (txtZsMc.Text.Equals(ComSpread.SpdGetValue(fspdMc, i, 1)))
            //    {
            //        chkMckey = true;
            //        break;
            //    }
            //}
            //判断名称KEY 是否存在,不存在不做删除操作
            if (chkMckey == false)
            {
                ComForm.DspMsg("W063", "客户名称");

                txtGYSMC.Focus();
                return;
            }

            if (Const.LING == ComForm.DspMsg("Q003", ""))
            {
                try
                {
                    //_modelFMD030.KHBH = txtDZ.Text.strReplace();
                    //_modelFMD030.KHMC = txtZsMc.Text.strReplace();
                    //_bllFMD030.Delete(_modelFMD030.KHBH, "");
                    ComForm.DspMsg("M001", "");
                    txtDZ.Focus();
                }
                catch (Exception ew)
                {
                    ComForm.DspMsg("E001", "");
                    return;
                }
                txtDZ.Text      = string.Empty;
                txtGYSSLMC.Text = string.Empty;
                txtGYSMC.Text   = string.Empty;
                fillSPD();
            }
        }
Esempio n. 19
0
        //保存按钮
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtGYSMC.Text.strReplace().IsNullOrEmpty())
            {
                ComForm.DspMsg("W002", "供应商名称");
                txtGYSMC.Focus();
                return;
            }

            if (DBHelper.Exists(TableName, "and GYSMC='" + txtGYSMC.Text.strReplace() + "'"))
            {
                ComForm.DspMsg("W068", "供应商名称");
                txtGYSMC.Focus();
                return;
            }
            if (ComConst.LING == ComForm.DspMsg("Q004", ""))
            {
                try
                {
                    Model.fmd030 _modelFMD030 = new Model.fmd030();
                    _modelFMD030.ID      = iID;
                    _modelFMD030.GYSMC   = txtGYSMC.Text.strReplace();
                    _modelFMD030.GYSSLMC = txtGYSSLMC.Text.strReplace();
                    _modelFMD030.DZ      = txtDZ.Text.strReplace();
                    _modelFMD030.DH      = txtDH.Text.strReplace();
                    _modelFMD030.LXR     = txtLXR.Text.strReplace();
                    if (_modelFMD030.ID != -1)
                    {
                        //更新数据
                        _modelFMD030.GXZBH = ComForm.strUserName;
                        _modelFMD030.GXR   = PublicFun.GetSystemDateTime(Const.Date, Const.dateStyle_YMD);
                        _modelFMD030.GXSJ  = PublicFun.GetSystemDateTime(Const.Time, string.Empty);
                        _modelFMD030.GXDMM = systemdate.Get_SysDNBH();
                        DbHelperMySql.ExecuteSql(DBHelper.Update(TableName, _modelFMD030, " and ID=" + _modelFMD030.ID + ""));

                        //_bllFMD030.Update(_modelFMD030);
                        ComForm.DspMsg("M002", "");
                        txtGYSMC.Focus();
                    }
                    else
                    {
                        //插入数据
                        _modelFMD030.ID    = null;
                        _modelFMD030.RLZBH = ComForm.strUserName;
                        _modelFMD030.RLR   = PublicFun.GetSystemDateTime(Const.Date, Const.dateStyle_YMD);
                        _modelFMD030.RLSJ  = PublicFun.GetSystemDateTime(Const.Time, string.Empty);
                        _modelFMD030.RLDMM = systemdate.Get_SysDNBH();
                        DbHelperMySql.ExecuteSql(DBHelper.Add(TableName, _modelFMD030));
                        ComForm.DspMsg("M002", "");
                        txtGYSMC.Focus();
                    }
                }
                catch (Exception ew)
                {
                    ComForm.DspMsg("E001", "");
                    ComForm.InsertErrLog(ew.ToString(), this.Name);
                    return;
                }
                Init();
            }
        }