Esempio n. 1
0
        private void LoadUserInfo()
        {
            //如果是修改加载user信息  用户账号不允许修改
            if (this.Owner is ConfigManager)
            {
                ConfigManager configManager = (ConfigManager)this.Owner;
                if (configManager.flag.Equals("2"))
                {
                    ScanDataSet scandataset = new Business.ConfigInfo().GetConfigInfoByID(configManager.configID);
                    if (scandataset.ConfigInfo.Rows.Count > 0)
                    {
                        configTable = scandataset.ConfigInfo;
                        configRow   = scandataset.ConfigInfo.Rows[0];

                        this.tbsite.Text            = configRow["site"].ToString();
                        this.tbSDKPath.Text         = configRow["sdkpath"].ToString();
                        this.tbSDKSN.Text           = configRow["sdksn"].ToString();
                        this.cbDBType.SelectedValue = configRow["dbtype"].ToString();
                        this.tbServer.Text          = configRow["server"].ToString();
                        this.tbUserName.Text        = configRow["username"].ToString();
                        this.tbPassWord.Text        = configRow["password"].ToString();

                        string status = configRow["status"].ToString();
                        switch (status)
                        {
                        case "1":
                            this.StartRadioButton.Checked = true;
                            break;

                        case "0":
                            this.ForbidRadioButton.Checked = true;
                            break;

                        default:
                            this.StartRadioButton.Checked = true;
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show("获取用户信息错误!");
                        return;
                    }
                }
            }
        }
Esempio n. 2
0
 private void btnUpdateStatus_Click(object sender, EventArgs e)
 {
     //判断选中几行
     try
     {
         int  count  = 0;
         bool result = false;
         for (int i = 0; i < this.dgvConfigInfo.Rows.Count; i++)
         {
             if (this.dgvConfigInfo.Rows[i].Cells[this.dgvConfigInfo.Columns["SelectCheck"].Index].EditedFormattedValue.ToString() == "True")
             {
                 count++;
                 this.configID = this.dgvConfigInfo.Rows[i].Cells["id"].Value.ToString();
                 string      status      = this.dgvConfigInfo.Rows[i].Cells["status"].Value.ToString();
                 ScanDataSet scanDataSet = new Business.ConfigInfo().GetConfigInfoByID(this.configID);
                 if (scanDataSet.ConfigInfo.Rows.Count > 0)
                 {
                     ScanDataSet.ConfigInfoDataTable dt = scanDataSet.ConfigInfo;
                     dt.Rows[0]["status"] = status == "1" ? "0" : "1";
                     result = new Business.ConfigInfo().AddConfig(dt);
                 }
             }
         }
         if (count == 0)
         {
             MessageBox.Show("请选择要修改的行!");
             return;
         }
         else if (count > 1)
         {
             MessageBox.Show("请选择一行修改记录!");
             return;
         }
         if (result)
         {
             MessageBox.Show("更新成功!");
             return;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                //校验数据
                CheckContent();
                bool          result;
                ConfigManager configManager;

                //判断是新增 or 修改
                if (this.Owner is ConfigManager)
                {
                    configManager = (ConfigManager)this.Owner;
                    if (configManager.flag.Equals("1"))
                    {
                        configTable   = new ScanDataSet.ConfigInfoDataTable();
                        configInfoRow = configTable.NewConfigInfoRow();


                        configInfoRow.Site = this.tbsite.Text.Trim();

                        configInfoRow.SdkPath  = this.tbSDKPath.Text.Trim();
                        configInfoRow.SdkSn    = this.tbSDKSN.Text.Trim();
                        configInfoRow.Forgid   = ((ConfigManager)this.Owner).orgID;
                        configInfoRow.Frcode   = ((ConfigManager)this.Owner).frcode;
                        configInfoRow.DbType   = this.cbDBType.SelectedValue.ToString();
                        configInfoRow.Server   = this.tbServer.Text.Trim();
                        configInfoRow.UserName = this.tbUserName.Text.Trim();
                        configInfoRow.PassWord = this.tbPassWord.Text.Trim();
                        configInfoRow.DbName   = this.tbDBName.Text.Trim();
                        string status = "";
                        if (this.StartRadioButton.Checked)
                        {
                            status = "1";
                        }

                        if (this.ForbidRadioButton.Checked)
                        {
                            status = "0";
                        }
                        configInfoRow.Status = status;

                        configTable.AddConfigInfoRow(configInfoRow);

                        result = new Business.ConfigInfo().AddConfig(configTable);
                    }
                    else if (configManager.flag.Equals("2"))
                    {
                        ScanDataSet scandataset = new Business.ConfigInfo().GetConfigInfoByID(configManager.configID);
                        if (scandataset.ConfigInfo.Rows.Count > 0)
                        {
                            configTable = scandataset.ConfigInfo;
                            configRow   = scandataset.ConfigInfo.Rows[0];

                            configRow["site"]     = this.tbsite.Text.Trim();
                            configRow["sdkpath"]  = this.tbSDKPath.Text.Trim();
                            configRow["sdksn"]    = this.tbSDKSN.Text.Trim();
                            configRow["dbtype"]   = this.cbDBType.SelectedValue.ToString();
                            configRow["server"]   = this.tbServer.Text.Trim();
                            configRow["username"] = this.tbUserName.Text.Trim();
                            configRow["password"] = this.tbPassWord.Text.Trim();
                            configRow["dbname"]   = this.tbDBName.Text.Trim();
                            string status = "";
                            if (this.StartRadioButton.Checked)
                            {
                                status = "1";
                            }

                            if (this.ForbidRadioButton.Checked)
                            {
                                status = "0";
                            }
                            configRow["status"] = status;

                            if (!String.IsNullOrEmpty(((ConfigManager)this.Owner).configID))
                            {
                                configRow["id"] = ((ConfigManager)this.Owner).configID;
                            }
                            result = new Business.ConfigInfo().AddConfig(configTable);
                        }
                        else
                        {
                            MessageBox.Show("获取用户信息错误!");
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("获取业务标记错误!");
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("获取父窗口错误!");
                    return;
                }



                if (result)
                {
                    MessageBox.Show("保存成功!");
                    configManager.SearchData();
                    this.Close();
                    return;
                }
                else
                {
                    MessageBox.Show("保存失败!");

                    return;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }