예제 #1
0
        private void ShowTestResult(bool flag)
        {
            FormLoading.EndLoading();
            if (flag)
            {
                string _connString = Secret.Encrypt3DES(connString, LocalVariable.Key);

                if (ConfigManager.SaveConnString(ConfigConst.ConnectionManageString, _connString, ConfigConst.ConfigPath) &&
                    ConfigManager.SaveConnString(ConfigConst.ConnectionStringWrite, _connString, ConfigConst.ConfigPath) &&
                    ConfigManager.SaveConnString(ConfigConst.ConnectionStringReadonly, _connString, ConfigConst.ConfigPath) &&
                    ConfigManager.SaveConnString(ConfigConst.ConStrManageSql, _connString, ConfigConst.ConfigPath))
                {
                    LocalVariable.SetConnStringValue(ConfigConst.ConnectionManageString, connString);
                    LocalVariable.SetConnStringValue(ConfigConst.ConnectionStringWrite, connString);
                    LocalVariable.SetConnStringValue(ConfigConst.ConnectionStringReadonly, connString);
                    LocalVariable.SetConnStringValue(ConfigConst.ConStrManageSql, connString);

                    FormMessgeBox.ShowMsg(this, "测试成功,并保存!", this.panelTop.BackColor);
                    this.myLock = true;
                    this.Close();
                }
                else
                {
                    FormMessgeBox.ShowMsg(this, "测试成功,但保存失败!", this.panelTop.BackColor);
                }
            }
            else
            {
                FormMessgeBox.ShowMsg(this, "测试失败!", this.panelTop.BackColor);
            }
            this.myLock = true;
        }
예제 #2
0
        private void LoginResult(object obj)
        {
            this.uiHandler -= new UiHandler(this.LoginResult);
            string errMsg = obj.ToString();

            if (!string.IsNullOrEmpty(errMsg))
            {
                FormLoading.EndLoading();
                FormMessgeBox.ShowMsg(this, errMsg, this.panelTop.BackColor);
                this.enableFlag = true;
                return;
            }


            if (GlobalStaticObj.gLoginDataSet == null ||
                GlobalStaticObj.gLoginDataSet.Tables.Count == 0 ||
                GlobalStaticObj.gLoginDataSet.Tables[0].Rows.Count < 1)
            {
                this.enableFlag = true;
                FormLoading.EndLoading();
                FormMessgeBox.ShowMsg(this, "用户名或密码错误!", this.panelTop.BackColor);
                return;
            }

            if (HXCServerWinForm.GlobalStaticObj.gLoginDataSet.Tables[0].Rows.Count < 1)
            {
                this.enableFlag = true;
                FormMessgeBox.ShowMsg(this, "数据加载失败!", this.panelTop.BackColor);
                FormLoading.EndLoading();
                return;
            }

            #region 设置全局变量
            GlobalStaticObj_Server.Instance.UserID    = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["user_id"].ToString();
            GlobalStaticObj_Server.Instance.UserName  = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["user_name"].ToString();
            GlobalStaticObj_Server.Instance.LoginName = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["land_name"].ToString();
            GlobalStaticObj_Server.Instance.PassWord  = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["password"].ToString();

            GlobalStaticObj_Server.Instance.RoleID   = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["role_id"].ToString();
            GlobalStaticObj_Server.Instance.RoleName = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["role_name"].ToString();
            GlobalStaticObj_Server.Instance.OrgID    = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["org_id"].ToString();
            GlobalStaticObj_Server.Instance.OrgName  = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["org_name"].ToString();

            GlobalStaticObj_Server.Instance.ComID     = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["com_id"].ToString();
            GlobalStaticObj_Server.Instance.ComName   = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["com_name"].ToString();
            GlobalStaticObj_Server.Instance.LoginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            #endregion

            //预加载信息
            //LocalCache.PreLoad();

            //登录记忆保存
            this.SaveMemery();

            FormLoading.EndLoading();
            this.DialogResult = DialogResult.OK;//关键:设置登陆成功状态
        }
예제 #3
0
 private void timer_Tick(object sender, EventArgs e)
 {
     if (!this.enableFlag)
     {
         FormLoading.EndLoading();
         if (!InetetTest(GlobalStaticObj.DataServerIp, 200))
         {
             FormMessgeBox.ShowMsg(this, "无法连接服务器!", this.panelTop.BackColor);
         }
         else
         {
             FormMessgeBox.ShowMsg(this, "服务器登录超时!", this.panelTop.BackColor);
         }
         this.enableFlag = true;
     }
     this.timer.Enabled = false;
 }
예제 #4
0
 private void ShowAccData(object obj)
 {
     this.uiHandler -= new UiHandler(this.ShowAccData);
     if (obj.ToString().Length > 0)
     {
         FormLoading.EndLoading();
         if (this.formSet == null || !this.formSet.Visible)
         {
             FormMessgeBox.ShowMsg(this, "无法加载帐套数据!", this.panelTop.BackColor);
         }
     }
     this.enableFlag = true;
     //加载帐套
     if (this.dtDb.Rows.Count > 0)
     {
         this.tbDb.Caption = this.dtDb.Rows[0]["DisplayName"].ToString();
         this.tbDb.Tag     = this.dtDb.Rows[0]["Value"].ToString();
         if (this.tbUser.Caption.Trim().Length == 0)
         {
             this.tbUser.Focus();
         }
         else
         {
             if (this.tbPwd.Caption.Trim().Length == 0)
             {
                 this.tbPwd.Focus();
             }
             else
             {
                 this.panelLogin.Focus();
             }
         }
     }
     this.formCmb               = new FormCmb();
     this.formCmb.DisplayName   = "DisplayName";
     this.formCmb.ValueName     = "Value";
     this.formCmb.ItemHeight    = 35;
     this.formCmb.BackColor     = Color.White;
     this.formCmb.SelectedColor = Color.FromArgb(97, 167, 208);
     this.formCmb.ItemSelected += new FormCmb.ItemSelectedHandler(this.SeletecdAccount);
     this.formCmb.BindCmb(this.tbDb.InnerTextBox, this.dtDb, this.tbDb.Location.X,
                          this.panelDb.Height - this.tbDb.Location.Y - this.tbDb.Height, false);
 }
예제 #5
0
        /// <summary>
        /// 查询同步过的数据
        /// </summary>
        /// <param name="obj"></param>
        private void ShowData(object obj)
        {
            DataTable dt = obj as DataTable;

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    intDetailCount = dt.Rows.Count;
                    DataRow dr = dt.Rows[0];

                    #region 基础信息
                    info_status_yt = CommonCtrl.IsNullToString(dr["info_status_yt"]);                     //宇通单据状态
                    laboldpart_receipts_no.Text  = CommonCtrl.IsNullToString(dr["oldpart_receipts_no"]);  //旧件回收单号
                    labservice_station_code.Text = CommonCtrl.IsNullToString(dr["service_station_code"]); //服务站编码
                    labservice_station_name.Text = CommonCtrl.IsNullToString(dr["service_station_name"]); //服务站名称
                    string CreateTime = CommonCtrl.IsNullToString(dr["create_time_yt"]);                  //创建时间
                    if (!string.IsNullOrEmpty(CreateTime))
                    {
                        labytcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(CreateTime)).ToString();
                    }
                    string DepotTime = CommonCtrl.IsNullToString(dr["depot_time"]);//回厂时间
                    if (!string.IsNullOrEmpty(DepotTime))
                    {
                        labdepot_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(DepotTime)).ToString();
                    }
                    string NitarizeTime = CommonCtrl.IsNullToString(dr["notarize_time"]);//确认时间
                    if (!string.IsNullOrEmpty(NitarizeTime))
                    {
                        labnotarize_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(NitarizeTime)).ToString();
                    }
                    labsum_money.Text = CommonCtrl.IsNullToString(dr["sum_money"]); //旧件回收费用
                    strId             = CommonCtrl.IsNullToString(dr["return_id"]); //旧件返厂单Id
                    #endregion

                    #region 详细信息
                    DataTable dmt = DBHelper.GetTable("宇通旧件返厂明细数据", "tb_maintain_oldpart_recycle_material_detail", "*", string.Format(" maintain_id='{0}'", strId), "", "");
                    if (dmt.Rows.Count > 0)
                    {
                        if (dmt.Rows.Count > dgvMaterials.Rows.Count)
                        {
                            dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1);
                        }
                        for (int i = 0; i < dmt.Rows.Count; i++)
                        {
                            DataRow dmr = dmt.Rows[i];
                            dgvMaterials.Rows[i].Cells["service_no"].Value          = CommonCtrl.IsNullToString(dmr["service_no"]);
                            dgvMaterials.Rows[i].Cells["parts_code"].Value          = CommonCtrl.IsNullToString(dmr["parts_code"]);
                            dgvMaterials.Rows[i].Cells["parts_name"].Value          = CommonCtrl.IsNullToString(dmr["parts_name"]);
                            dgvMaterials.Rows[i].Cells["change_num"].Value          = CommonCtrl.IsNullToString(dmr["change_num"]);
                            dgvMaterials.Rows[i].Cells["send_num"].Value            = CommonCtrl.IsNullToString(dmr["send_num"]);
                            dgvMaterials.Rows[i].Cells["receive_num"].Value         = CommonCtrl.IsNullToString(dmr["receive_num"]);
                            dgvMaterials.Rows[i].Cells["unit"].Value                = CommonCtrl.IsNullToString(dmr["unit"]);
                            dgvMaterials.Rows[i].Cells["unit_price"].Value          = CommonCtrl.IsNullToString(dmr["unit_price"]);
                            dgvMaterials.Rows[i].Cells["need_recycle_mark"].Value   = CommonCtrl.IsNullToString(dmr["need_recycle_mark"]);
                            dgvMaterials.Rows[i].Cells["all_recycle_mark"].Value    = CommonCtrl.IsNullToString(dmr["all_recycle_mark"]);
                            dgvMaterials.Rows[i].Cells["original"].Value            = CommonCtrl.IsNullToString(dmr["original"]);
                            dgvMaterials.Rows[i].Cells["identity_state"].Value      = CommonCtrl.IsNullToString(dmr["identity_state"]);
                            dgvMaterials.Rows[i].Cells["second_station_code"].Value = CommonCtrl.IsNullToString(dmr["second_station_code"]);
                            dgvMaterials.Rows[i].Cells["process_mode"].Value        = CommonCtrl.IsNullToString(dmr["process_mode"]);
                            dgvMaterials.Rows[i].Cells["remarks"].Value             = CommonCtrl.IsNullToString(dmr["remarks"]);
                            dgvMaterials.Rows[i].Cells["receive_explain"].Value     = CommonCtrl.IsNullToString(dmr["receive_explain"]);
                            dgvMaterials.Rows[i].Cells["parts_id"].Value            = CommonCtrl.IsNullToString(dmr["parts_id"]);
                        }
                    }
                    #endregion
                }
                else
                {
                    FormLoading.EndLoading();
                    MessageBoxEx.Show("该日期范围内暂无数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
                    return;
                }
            }
            FormLoading.EndLoading();
        }
예제 #6
0
        private void LoginResult(object obj)
        {
            this.uiHandler -= new UiHandler(this.LoginResult);

            if (this.enableFlag)
            {
                return;
            }

            this.timer.Enabled = false;

            string errMsg = obj.ToString();

            if (!string.IsNullOrEmpty(errMsg))
            {
                FormLoading.EndLoading();
                FormMessgeBox.ShowMsg(this, errMsg, this.panelTop.BackColor);
                this.enableFlag = true;
                return;
            }

            if (HXCPcClient.GlobalStaticObj.gLoginDataSet == null)
            {
                FormMessgeBox.ShowMsg(this, "数据加载失败!", this.panelTop.BackColor);
                FormLoading.EndLoading();
                this.enableFlag = true;
                return;
            }

            if (HXCPcClient.GlobalStaticObj.gLoginDataSet.Tables[0].Rows.Count < 1)
            {
                FormLoading.EndLoading();
                this.enableFlag = true;
                return;
            }

            try
            {
                #region  务站信息   add by kord
                var dr = DBHelper.GetTable("获取当前服务站信息", GlobalStaticObj.CommAccCode, "tb_company", "*", "data_source = '2'", "", "");
                if (dr == null || dr.Rows.Count == 0)
                {
                    GlobalStaticObj.GlobalLogService.WriteLog("无法获取当前服务站信息");
                }
                else
                {
                    GlobalStaticObj.ServerStationCode = CommonCtrl.IsNullToString(dr.Rows[0]["sap_code"]);
                    GlobalStaticObj.ServerStationName = CommonCtrl.IsNullToString(dr.Rows[0]["com_name"]);
                }
                #endregion

                GlobalStaticObj.CookieStr            = GlobalStaticObj.gLoginDataSet.Tables["cookieStr"].Rows[0][0].ToString();
                GlobalStaticObj.UserID               = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["user_id"].ToString();
                GlobalStaticObj.UserName             = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["user_name"].ToString();
                GlobalStaticObj.LandName             = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["land_name"].ToString();
                GlobalStaticObj.PassWord             = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["password"].ToString();
                GlobalStaticObj.CurrUserCom_Id       = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["com_id"].ToString();
                GlobalStaticObj.CurrUserCom_Code     = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["com_code"].ToString();
                GlobalStaticObj.CurrUserCom_Name     = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["com_name"].ToString();
                GlobalStaticObj.CurrUserOrg_Id       = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["org_id"].ToString();
                GlobalStaticObj.CurrUserOrg_Name     = GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["org_name"].ToString();
                GlobalStaticObj.CurrUserCom_Category = CommonCtrl.IsNullToString(HXCPcClient.GlobalStaticObj.gLoginDataSet.Tables[0].Rows[0]["category"]);  //modify by kord
            }
            catch (Exception ex)
            {
                //write log
            }

            ThreadPool.SetMinThreads(3, 3);
            ThreadPool.SetMaxThreads(5, 5);

            //预加载信息
            LocalCache.PreLoad();

            //记忆登录保存
            this.SaveMemery();

            FormLoading.EndLoading();
            this.DialogResult = DialogResult.OK;//关键:设置登陆成功状态
        }