示例#1
0
        private void BtnApply_Click(object sender, RoutedEventArgs e)
        {
            var prt = DataGridProducts.SelectedItem as Product;

            if (prt == null)
            {
                return;
            }

            if (_isAdding)//应用添加商品操作
            {
                _isAdding = false;
                if (_productManager.AddProduct(prt))
                {
                    ZMessageBox.Show("商品添加成功..");
                }
                else
                {
                    ZMessageBox.Show("商品添加失败..");
                }
            }
            else//应用修改商品操作
            {
                if (_productManager.ModifyProduct(prt))
                {
                    ZMessageBox.Show("商品修改成功..");
                }
                else
                {
                    ZMessageBox.Show("商品修改失败..");
                }
            }
        }
示例#2
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (formValid.IsValid)
     {
         string       loginName = txtLoginName.Text.Trim();
         string       loginPwd  = EncryptUtils.EncryptFromInputString(txtLoginPwd.Text.Trim());
         TBUserEntity entity    = userManager.GetUserByLoginName(loginName);
         if (null == entity)
         {
             ZMessageBox.Show(this, "用户不存在,请联系管理员!", "提示", ZMessageBoxIcon.Information,
                              ZMessageBoxButtons.OK);
             this.DialogResult = DialogResult.None;
         }
         else
         {
             if (entity.UserPassword.Equals(loginPwd))
             {
                 ZMessageBox.Show(this, "登录成功!", "提示", ZMessageBoxIcon.Information,
                                  ZMessageBoxButtons.OK);
                 this.CurrentLoginUser = entity;
                 this.DialogResult     = DialogResult.OK;
                 this.Close();
             }
             else
             {
                 ZMessageBox.Show(this, "密码错误,请重新输入!", "提示", ZMessageBoxIcon.Information,
                                  ZMessageBoxButtons.OK);
                 this.DialogResult = DialogResult.None;
             }
         }
     }
 }
        private void FlatButton_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            switch (btn.Content.ToString())
            {
            case "Info":
                if (ZMessageBox.Show("内容", "标题", EnumPromptType.Error) == MessageBoxResult.OK)
                {
                    MessageBox.Show("点击了OK");
                }
                break;

            case "Error":
                ZMessageBox.Show(Window.GetWindow(this), "您目前使用的浏览器版本过低,可能导致产品部分功能无法正常使用", "", MessageBoxButton.YesNoCancel, EnumPromptType.Warn);
                break;

            case "Warn":
                ZMessageBox.Show("内容", EnumPromptType.Warn);
                break;

            case "Success":
                ZMessageBox.Show("内容", EnumPromptType.Success);
                break;

            default:
                break;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (formValid.IsValid)
            {
                DASP.Domain.Entitys.TBUserEntity curUser = Global.UserInfoInstance.CurrentLoginUser;
                string oldPwd = EncryptUtils.EncryptFromInputString(txtProtoPwd.Text.Trim());
                if (!curUser.UserPassword.Equals(oldPwd))
                {
                    ZMessageBox.Show(this, "旧密码输入错误!", "提示", ZMessageBoxIcon.Information,
                                     ZMessageBoxButtons.OK);
                    this.DialogResult = DialogResult.None;
                    return;
                }

                curUser.UserPassword = EncryptUtils.EncryptFromInputString(txtNewPwd.Text.Trim());

                try
                {
                    userManager.Update(curUser);
                    ZMessageBox.Show(this, "修改密码成功!", "提示", ZMessageBoxIcon.Information,
                                     ZMessageBoxButtons.OK);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
示例#5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (formValid.IsValid)
            {
                string   projectName = txtProjectName.Text.Trim();
                string   projectDate = txtProjectDate.Text.Trim();
                DateTime result;
                if (!DateTime.TryParse(projectDate, out result))
                {
                    ZMessageBox.Show(this, string.Format("合同日期不是时间格式!"), "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                    return;
                }

                string projectLeader = txtProjectLeader.Text.Trim();
                string projectRemark = txtProjectRemark.Text.Trim();

                DASP.Domain.Entitys.TBProjectEntity entity = null;
                bool isUpdate = false;
                if (this.projectEntity != null)
                {
                    entity   = this.projectEntity;
                    isUpdate = true;
                }
                else
                {
                    entity            = new DASP.Domain.Entitys.TBProjectEntity();
                    entity.ProjectId  = Guid.NewGuid();
                    entity.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    isUpdate          = false;
                }

                entity.ProjectName   = projectName;
                entity.ProjectDate   = projectDate;
                entity.ProjectLeader = projectLeader;
                entity.Remark        = projectRemark;
                entity.UpdateTime    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                entity.Creator       = Global.UserInfoInstance.CurrentLoginUser;

                try
                {
                    if (isUpdate)
                    {
                        projectManager.Update(entity);
                    }
                    else
                    {
                        projectManager.Save(entity);
                    }

                    ZMessageBox.Show(this, "保存成功!", "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                    this.Close();
                }
                catch (Exception ex)
                {
                    ZMessageBox.Show(this, string.Format("保存失败:{0}!", ex.Message), "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                }
            }
        }
示例#6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (formValid.IsValid)
            {
                bool isUpdate = false;
                if (this.tunnelEntity == null)
                {
                    this.tunnelEntity                 = new DASP.Domain.Entitys.TBTunnelEntity();
                    this.tunnelEntity.TunnelId        = Guid.NewGuid();
                    this.tunnelEntity.TunnelName      = txtTunnelName.Text.Trim();
                    this.tunnelEntity.TunnelStartDate = txtStartDate.Text.Trim();
                    this.tunnelEntity.TunnelEndDate   = txtEndDate.Text.Trim();
                    this.tunnelEntity.TunnelLeader    = txtLeader.Text.Trim();
                    this.tunnelEntity.Remark          = txtRemark.Text.Trim();


                    this.tunnelEntity.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    this.tunnelEntity.Creator    = Global.UserInfoInstance.CurrentLoginUser;
                    this.tunnelEntity.Project    = (DASP.Domain.Entitys.TBProjectEntity)cboBoxProject.SelectedItem;

                    isUpdate = false;
                }
                else
                {
                    this.tunnelEntity.TunnelName      = txtTunnelName.Text.Trim();
                    this.tunnelEntity.TunnelStartDate = txtStartDate.Text.Trim();
                    this.tunnelEntity.TunnelEndDate   = txtEndDate.Text.Trim();
                    this.tunnelEntity.TunnelLeader    = txtLeader.Text.Trim();
                    this.tunnelEntity.Remark          = txtRemark.Text.Trim();

                    this.tunnelEntity.Creator = Global.UserInfoInstance.CurrentLoginUser;
                    this.tunnelEntity.Project = (DASP.Domain.Entitys.TBProjectEntity)cboBoxProject.SelectedItem;
                    isUpdate = true;
                }

                this.tunnelEntity.UpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                try
                {
                    if (isUpdate)
                    {
                        tunnelManager.Update(this.tunnelEntity);
                    }
                    else
                    {
                        tunnelManager.Save(this.tunnelEntity);
                    }

                    ZMessageBox.Show(this, "保存成功!", "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                    this.Close();
                }
                catch (Exception ex)
                {
                    ZMessageBox.Show(this, string.Format("保存失败:{0}!", ex.Message), "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                }
            }
        }
示例#7
0
        private void Remove_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var prt = DataGridProducts.SelectedItem as Product;

            if (_productManager.RemoveProduct(prt.ID))
            {
                ZMessageBox.Show("删除成功..");
                var prts = DataGridProducts.ItemsSource as ICollection <Product>;
                prts.Remove(prt);
            }
            else
            {
                ZMessageBox.Show("删除失败..");
            }
        }
示例#8
0
        //删除账户
        private void Remove_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var acc = (string)ListBoxAccounts.SelectedItem;

            if (_userManager.RemoveUser(acc))
            {
                ZMessageBox.Show("删除成功..");
                _users.Remove(acc);
                ListBoxAccounts.Items.Refresh();
            }
            else
            {
                ZMessageBox.Show("删除失败..");
            }
        }
示例#9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (formValid.IsValid)
            {
                bool isUpdate;

                if (null != fanPosEntity)
                {
                    isUpdate = true;
                }
                else
                {
                    fanPosEntity            = new DASP.Domain.Entitys.TBFanPositionEntity();
                    fanPosEntity.PositionId = Guid.NewGuid();
                    fanPosEntity.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    isUpdate = false;
                }

                DASP.Domain.Entitys.TBTunnelEntity tunnel = cboBoxTunnel.SelectedItem as DASP.Domain.Entitys.TBTunnelEntity;
                fanPosEntity.Tunnel       = tunnel;
                fanPosEntity.LaneWay      = byte.Parse(cboBoxLaneWay.SelectedValue.ToString());
                fanPosEntity.HoleWay      = byte.Parse(cboBoxHoleWay.SelectedValue.ToString());
                fanPosEntity.Creator      = Global.UserInfoInstance.CurrentLoginUser;
                fanPosEntity.PositionName = txtFanPosName.Text.Trim();
                fanPosEntity.Ramark       = txtRemark.Text.Trim();

                fanPosEntity.UpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                try
                {
                    if (isUpdate)
                    {
                        posManager.Update(fanPosEntity);
                    }
                    else
                    {
                        posManager.Save(fanPosEntity);
                    }

                    ZMessageBox.Show(this, "保存成功!", "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                    this.Close();
                }
                catch (Exception ex)
                {
                    ZMessageBox.Show(this, string.Format("保存失败:{0}!", ex.Message), "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                }
            }
        }
示例#10
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (WTUsername.Text == "" || WTUsername.Text == "")
            {
                ZMessageBox.Show("信息不完整..");
                return;
            }

            if (_uManager.Login(WTUsername.Text, WTPassword.Text))
            {
                _isLogined = true;
                this.Close();
            }
            else
            {
                ZMessageBox.Show("登录失败..\n请检查用户名与密码..");
            }
        }
示例#11
0
        //添加账户
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            string group = ComboBoxGroup.Text;

            if (WTUsername.Text == "" || WTPassword.Text == "")
            {
                ZMessageBox.Show("信息不完整..");
                return;
            }

            if (_userManager.AddUser(WTUsername.Text, WTPassword.Text, group))
            {
                ZMessageBox.Show("添加成功..");
                _users.Add(WTUsername.Text);
                ListBoxAccounts.Items.Refresh();
            }
            else
            {
                ZMessageBox.Show("添加失败..");
            }
        }
示例#12
0
        private void btnCreateDB_Click(object sender, EventArgs e)
        {
            if (formValid.IsValid)
            {
                bool canSuccess = false;
                try
                {
                    string dbName = txtDBName.Text.Trim();
                    MSSqlUtils.CreateDB(dbName);
                    canSuccess = true;
                }
                catch (Exception ex)
                {
                    ZMessageBox.Show(this, ex.Message, "提示", ZMessageBoxIcon.Error, ZMessageBoxButtons.OK);
                }

                if (canSuccess)
                {
                    ZMessageBox.Show(this, "数据库创建成功!", "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                }
            }
        }
示例#13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (formValid.IsValid)
            {
                if (tspConfigList == null || (tspConfigList != null && tspConfigList.Count <= 0))
                {
                    ZMessageBox.Show(this, "请选导入配置数据!", "提示", ZMessageBoxIcon.Information,
                                     ZMessageBoxButtons.OK);
                    return;
                }

                if (stsDataList == null || (stsDataList != null && stsDataList.Count <= 0))
                {
                    ZMessageBox.Show(this, "请选导入数据!", "提示", ZMessageBoxIcon.Information,
                                     ZMessageBoxButtons.OK);
                    return;
                }
                bool isUpdate = false;

                if (testDataEntity == null)
                {
                    testDataEntity            = new DASP.Domain.Entitys.TBTestDataEntity();
                    testDataEntity.DataId     = Guid.NewGuid();
                    testDataEntity.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    isUpdate = false;
                }
                else
                {
                    isUpdate = true;
                }


                string       data = DASP.Tools.SerializerUtils.SerializeFromString(stsDataList[0].Data);
                List <float> v    = DASP.Tools.SerializerUtils.SerializeToObject(data) as List <float>;
                testDataEntity.Data        = data;
                testDataEntity.TestName    = txtTestName.Text.Trim();
                testDataEntity.FileHash    = stsDataList[0].FileHash;
                testDataEntity.TestCode    = int.Parse(txtTestCode.Text.Trim());
                testDataEntity.ChannelCode = int.Parse(cboBoxChannel.SelectedValue.ToString());
                testDataEntity.DataType    = byte.Parse(cboBoxDataType.SelectedValue.ToString());

                testDataEntity.SortCode   = int.Parse(txtSort.Text.Trim());
                testDataEntity.Remark     = mTxtRemark.Text.Trim();
                testDataEntity.Creator    = Global.UserInfoInstance.CurrentLoginUser;
                testDataEntity.TestTime   = dtpTestTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
                testDataEntity.UpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                DASP.Domain.Entitys.TBFanPositionEntity position = cboBoxFanPos.SelectedItem as DASP.Domain.Entitys.TBFanPositionEntity;
                testDataEntity.Position = position;

                DASP.Domain.Entitys.TBTestParameterEntity testParamEntity = new DASP.Domain.Entitys.TBTestParameterEntity();
                testParamEntity.ParamId    = testDataEntity.DataId;
                testParamEntity.FileHash   = tspConfigList[0].FileHash;
                testParamEntity.SF         = tspConfigList[0].SF;
                testParamEntity.TotalCh    = tspConfigList[0].TotalCh;
                testParamEntity.UpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                testParamEntity.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                testParamEntity.ADVer      = tspConfigList[0].ADVer;
                testParamEntity.Ch         = tspConfigList[0].Ch;
                testParamEntity.CV         = tspConfigList[0].CV;
                testParamEntity.Data       = testDataEntity;
                testParamEntity.EU         = tspConfigList[0].EU;
                testParamEntity.Gain       = tspConfigList[0].Gain;
                testParamEntity.ISC        = tspConfigList[0].ISC;
                testParamEntity.Pages      = tspConfigList[0].Pages;


                try
                {
                    if (isUpdate)
                    {
                        testDataManager.Update(testDataEntity);
                        testParamManager.Update(testParamEntity);
                    }
                    else
                    {
                        testDataManager.Save(testDataEntity);
                        testParamManager.Save(testParamEntity);
                    }

                    ZMessageBox.Show(this, "保存成功!", "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                    this.Close();
                }
                catch (Exception ex)
                {
                    ZMessageBox.Show(this, string.Format("保存失败:{0}!", ex.Message), "提示", ZMessageBoxIcon.Information, ZMessageBoxButtons.OK);
                }
            }
        }