Ejemplo n.º 1
0
 private void txtDZ_Validating(object sender, CancelEventArgs e)
 {
     try
     {
         //if ("0".Equals(txtDZ.Text) || "00".Equals(txtDZ.Text) || "000".Equals(txtDZ.Text))
         //{
         //    txtDZ.Text = string.Empty;
         //    return;
         //}
         //if (!txtDZ.Text.IsNullOrEmpty())
         //{
         //    txtDZ.Text = txtDZ.Text.PadLeft(6, '0');
         //}
         if (DBHelper.Exists("FMD000", " and "))
         {
             //_modelFMD030 = new Model.fmd030();
             //_modelFMD030 = _bllFMD030.GetModel(txtDZ.Text, "");
             //txtZsMc.Text = _modelFMD030.KHMC;
             //txtSxMc.Text = _modelFMD030.KHSXM;
         }
         else
         {
             txtGYSMC.Text   = "";
             txtGYSSLMC.Text = "";
         }
     }
     catch (Exception ex)
     {
         ComForm.InsertErrLog(ex.Message, this.Text);
     }
 }
Ejemplo n.º 2
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");
            }
        }
Ejemplo n.º 3
0
        private void fspdMc_CellDoubleClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
        {
            try
            {
                //权限判断
                string rt      = cboGlMc.SelectedValue.ToString();
                string ty      = rt.Substring(0, 1);
                string arrData = System.Configuration.ConfigurationSettings.AppSettings["QX"];

                if (arrData == "0" && ty == "9")
                {
                    this.txtMcKey.Enabled = false;
                    this.txtZsMc.Enabled  = false;
                    this.txtSxMc.Enabled  = false;
                    return;
                }
                if (this.fspdMc.ActiveSheet.Rows.Count == 0)
                {
                    return;
                }


                txtMcKey.Text = this.fspdMc.Sheets[0].Cells[e.Row, 0].Text.ToString().Trim().Substring(2);
                txtZsMc.Text  = this.fspdMc.Sheets[0].Cells[e.Row, 1].Text.ToString().Trim();
                txtSxMc.Text  = this.fspdMc.Sheets[0].Cells[e.Row, 2].Text.ToString().Trim();
                lblID.Text    = this.fspdMc.Sheets[0].Cells[e.Row, 3].Text.ToString().Trim();
            }
            catch (Exception ex)
            {
                ComForm.InsertErrLog(ex.Message, this.Text);
            }
        }
Ejemplo n.º 4
0
 static void UnhandledExceptionEventHandler(object sender, UnhandledExceptionEventArgs e)
 {
     try
     {
         ComForm.InsertErrLog("ExceptionObject" + e.ExceptionObject + "," + e.ToString(), "ERROR");
     }
     catch
     {
     }
 }
Ejemplo n.º 5
0
 private void WinFMD010_Load(object sender, EventArgs e)
 {
     try
     {
         Init();
     }
     catch (Exception ex)
     {
         ComForm.InsertErrLog(ex.Message, this.Text);
     }
 }
Ejemplo n.º 6
0
 private void WinFMD010_Load(object sender, EventArgs e)
 {
     try
     {
         //定义Spread 行数
         this.fspdMc.ActiveSheet.Rows.Count = 0;
         //combox绑定数据
         comboxBind(cboGlMc, "GLMC");
     }
     catch (Exception ex)
     {
         ComForm.InsertErrLog(ex.Message, this.Text);
     }
 }
Ejemplo n.º 7
0
        private void fillSPD()
        {
            try
            {
                //"" = cboGlMc.SelectedValue.ToString();
                //_modelFMD030.KHBH = txtDZ.Text.Trim();
                this.fspdMc.ActiveSheet.Rows.Count = 0;
                string        strWhere   = " and SCQF='0'";
                List <string> listFields = new List <string>();
                listFields.Add(" ID,GYSMC,GYSSLMC,DZ,DH,LXR");
                DataTable dtTable = DbHelperMySql.Query(DBHelper.getAllList(TableName, listFields, strWhere)).Tables[0];

                if (dtTable.Rows.Count > 0)
                {
                    for (int i = 0; i < dtTable.Rows.Count; i++)
                    {
                        this.fspdMc.ActiveSheet.Rows.Count++;
                        //往spread里填充数据
                        this.fspdMc.ActiveSheet.SetValue(i, 0, dtTable.Rows[i]["GYSMC"].ToString());
                        this.fspdMc.ActiveSheet.SetValue(i, 1, dtTable.Rows[i]["GYSSLMC"].ToString());
                        this.fspdMc.ActiveSheet.SetValue(i, 2, dtTable.Rows[i]["DZ"].ToString());
                        this.fspdMc.ActiveSheet.SetValue(i, 3, dtTable.Rows[i]["DH"].ToString());
                        this.fspdMc.ActiveSheet.SetValue(i, 4, dtTable.Rows[i]["LXR"].ToString());
                        this.fspdMc.ActiveSheet.SetValue(i, 5, dtTable.Rows[i]["ID"].ToString());
                    }

                    ComSpread.SpdSetFocus(fspdMc, 0, 0);
                    fspdMc.ActiveSheet.Rows[0].BackColor = Color.Lavender;
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                ComForm.InsertErrLog(ex.Message, this.Text);
            }
        }
Ejemplo n.º 8
0
        private void fspdMc_CellDoubleClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
        {
            try
            {
                //权限判断
                // string rt = cboGlMc.SelectedValue.ToString();
                //string ty = rt.Substring(0, 1);
                //string arrData = System.Configuration.ConfigurationSettings.AppSettings["QX"];


                txtGYSMC.Text   = this.fspdMc.ActiveSheet.Cells[e.Row, 0].Text.ToString().Trim();
                txtGYSSLMC.Text = this.fspdMc.ActiveSheet.Cells[e.Row, 1].Text.ToString().Trim();
                txtDZ.Text      = this.fspdMc.ActiveSheet.Cells[e.Row, 2].Text.ToString().Trim();
                txtDH.Text      = this.fspdMc.ActiveSheet.Cells[e.Row, 3].Text.ToString().Trim();
                txtLXR.Text     = this.fspdMc.ActiveSheet.Cells[e.Row, 4].Text.ToString().Trim();
                iID             = this.fspdMc.ActiveSheet.Cells[e.Row, 5].Text.ToString().StringToInt();
            }
            catch (Exception ex)
            {
                ComForm.InsertErrLog(ex.Message, this.Text);
            }
        }
Ejemplo n.º 9
0
        private void fillSPD()
        {
            try
            {
                if (cboGlMc.Text.ToString().IsNullOrEmpty())
                {
                    this.fspdMc.ActiveSheet.Rows.Count = 0;
                    return;
                }
                _modelFMD000.GLBH = cboGlMc.getValue();
                this.fspdMc.ActiveSheet.Rows.Count = 0;
                DataTable dtTable = _bllFMD000.getspread(_modelFMD000);

                if (dtTable.Rows.Count > 0)
                {
                    for (int i = 0; i < dtTable.Rows.Count; i++)
                    {
                        this.fspdMc.ActiveSheet.Rows.Count++;
                        //往spread里填充数据
                        this.fspdMc.ActiveSheet.SetValue(i, 0, dtTable.Rows[i]["glbh"].ToString());
                        this.fspdMc.ActiveSheet.SetValue(i, 1, dtTable.Rows[i]["zsmc"].ToString());
                        this.fspdMc.ActiveSheet.SetValue(i, 2, dtTable.Rows[i]["slmc"].ToString());
                        this.fspdMc.ActiveSheet.SetValue(i, 3, dtTable.Rows[i]["ID"].ToString());
                    }

                    //ComSpread.SpdSetFocus(fspdMc, 0, 0);
                    fspdMc.ActiveSheet.Rows[0].BackColor = Color.Lavender;
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                ComForm.InsertErrLog(ex.Message, this.Text);
            }
        }
Ejemplo n.º 10
0
 private void txtMcKey_Validating(object sender, CancelEventArgs e)
 {
     try
     {
         if (txtMcKey.Text.IsNullOrEmpty())
         {
             txtMcKey.Text = string.Empty;
             return;
         }
         if (!txtMcKey.Text.IsNullOrEmpty())
         {
             txtMcKey.Text = txtMcKey.Text.PadLeft(2, '0');
         }
         if (cboGlMc.Text.IsNullOrEmpty())
         {
             return;
         }
     }
     catch (Exception ex)
     {
         ComForm.InsertErrLog(ex.Message, this.Text);
     }
 }
Ejemplo n.º 11
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();
            }
        }
Ejemplo n.º 12
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();
            }
        }