Beispiel #1
0
        public RightSetViewModel()
        {
            //查询角色
            RoleDao roleDao = new RoleDao();
            var     roleRlt = roleDao.GetRoles();

            if (roleRlt.HasError)
            {
                MessageAlert.Alert(roleRlt.Msg);
            }
            else
            {
                Roles = roleRlt.Entities;
            }
            //查询所有权限
            RightDao rightDao = new RightDao();
            var      rightRlt = rightDao.GetRights();

            if (rightRlt.HasError)
            {
                MessageAlert.Alert(rightRlt.Msg);
            }
            else
            {
                Rights = rightRlt.Entities;
            }
        }
Beispiel #2
0
        private async void Delete()
        {
            if (!Global.HasRight("0503"))
            {
                MessageAlert.Alert("权限不足!");
                return;
            }
            if (SelectedRole == null)
            {
                MessageAlert.Alert("请选择要删除的记录!");
                return;
            }
            var confirm = await MessageAlert.Confirm("确定删除此记录?");

            if (!confirm)
            {
                return;
            }
            RoleDao dao = new RoleDao();
            var     rlt = dao.DeleteRole(SelectedRole.Id);

            if (rlt.HasError)
            {
                MessageAlert.Alert(rlt.Msg);
            }
            RefreshList(null);
        }
Beispiel #3
0
        private void add_Click(object sender, RoutedEventArgs e)
        {
            var c = tvProperties.SelectedItem as PropertyNodeItem;

            if (c == null)
            {
                c = new PropertyNodeItem();
                if (MessageAlert.Alter("是否添加顶级部门!"))
                {
                    c.id = 0;
                }
                else
                {
                    MessageAlert.Alert("请选则上级部门");
                    return;
                }
            }


            winDepartment wd = new winDepartment(c.id, c.id, true);

            wd.ShowDialog();
            this.tvProperties.ItemsSource = null;
            lt.TreeLoad();
            this.dataGrid1.ItemsSource = GetDepartmentModel();
        }
Beispiel #4
0
        void GetBycontion(Dictionary <string, string> contion)
        {
            List <wrench> wrenchs = Wrench.selectByContion(contion);

            if (wrenchs == null || wrenchs.Count < 0)
            {
                MessageAlert.Alert("没有该工具信息!");
                return;
            }
            foreach (wrench w in wrenchs)
            {
                if (wrenchRepairList.FindIndex(p => p.wrenchBarCode == w.wrenchBarCode) < 0)
                {
                    ToolModel e = GetToolModel(w);
                    wrenchRepairList.Add
                    (
                        new WrenchRepairBind()
                    {
                        wrenchCode       = e.wrenchCode,
                        wrenchBarCode    = e.wrenchBarCode,
                        wrenchParentName = e.speciesName,
                        isCheck          = true,
                        lastRepair       = e.lastrepair,
                        days             = e.cycletime.ToString("f0"),
                        isNeedCheck      = e.isallowcheck,
                        guid             = e.guid
                    }
                    );
                    // _toolmodellist.Add(e);
                }
            }
            return;
        }
Beispiel #5
0
        private void UpdateAccountDetails(DbRepository userRepository)
        {
            if (!ValidateRequiredFields())
            {
                return;
            }
            if (!ValidateDuplicateRecord())
            {
                return;
            }

            var repository = userRepository;
            var accountId  = GetAccountId(dgvAccount);
            var account    = repository.Users.GetById(accountId);

            if (account != null)
            {
                account.Name     = txtName.Text;
                account.Password = txtPassword.Text;
                account.RoleId   = (int)txtUserRole.SelectedValue;
                account.Username = txtUsername.Text;

                repository.Commit();
                MessageAlert.Show("Successfully Changed", "Update");
                ResetToDefault();
            }
        }
        private void bt_add_Click(object sender, RoutedEventArgs e)
        {
            if (this.lb_function.SelectedIndex < 0)
            {
                return;
            }
            if (cb_role.SelectedIndex < 0)
            {
                MessageAlert.Alert("请选择要分配的角色");
                return;
            }
            MenuItem mt = this.lb_function.SelectedItem as MenuItem;

            try
            {
                if (lv_havefunctio.Items.Count > 0)
                {
                    if (tempstring.FindIndex(p => p == mt.Header.ToString()) >= 0)
                    {
                        return;
                    }
                }
                tempstring.Add(mt.Header.ToString());
                lv_havefunctio.ItemsSource = null;
                lv_havefunctio.ItemsSource = tempstring;
            }
            catch { }
        }
        private void UpdateProductDetails(DbRepository dbRepository)
        {
            if (!ValidateRequiredFields())
            {
                return;
            }
            if (!ValidateDuplicateRecord())
            {
                return;
            }
            if (FlatMessageBox.Show("Do you want to update the changes?", "Update Product", DialogButtons.YesNo,
                                    DialogType.Question) == DialogButton.Yes)
            {
                var repository      = dbRepository;
                var selectedProduct = repository.Products.GetById(GetProductId());
                {
                    selectedProduct.ProductCode      = txtProductCode.Text.Trim();
                    selectedProduct.ProductName      = txtProductCode.Text.Trim();
                    selectedProduct.SalesRate        = decimal.Parse(txtSalesRate.Text);
                    selectedProduct.PurchaseRate     = decimal.Parse(txtPurchaseRate.Text);
                    selectedProduct.Unit             = txtUnit.Text.Trim();
                    selectedProduct.Description      = txtDescription.Text.Trim();
                    selectedProduct.Quantity         = int.Parse(txtQuantity.Text);
                    selectedProduct.DateTimeModified = DateTime.Now;
                    //selectedProduct.ModifiedBy = AccountSession.GetAccount.Id;
                };
                repository.Commit();
            }

            MessageAlert.Show("Successfully Changed");
            ResetToDefault();
        }
Beispiel #8
0
        private async void MiExit_Click(object sender, RoutedEventArgs e)
        {
            var rlt = await MessageAlert.Confirm("确定退出系统?");

            if (rlt)
            {
                this.Close();
                Environment.Exit(0);
            }
            //Messenger.Default.Send<object>(null, "test");
            //ToolMgt.BLL.UserDao dao = new BLL.UserDao();
            //Model.User u = dao.GetUser(1).Entities;
            //Model.User u2 = new Model.User()
            //{
            //    Id = u.Id,
            //    Code = u.Code,
            //    Name = u.Name,
            //    Note = u.Note,
            //    CardNo = u.CardNo,
            //    DeptId = u.DeptId,
            //    DutyId = u.DutyId,
            //    IsDel = u.IsDel,
            //    Phone = u.Phone,
            //    Pwd = u.Pwd
            //};
            //u2.Note = u2.Note + "&";
            //BLL.UserDao dao2 = new BLL.UserDao();
            //dao2.EditUser(u);
        }
Beispiel #9
0
 public static void OnMessageRecieveFire(MessageAlert e) //::Fire();
 {
     if (OnMessageRecieve != null)
     {
         OnMessageRecieve(e);
     }
 }
        private void bt_go_Click(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.Wait;
            if (string.IsNullOrEmpty(this.tb_mbpage.Text))
            {
                return;
            }
            int count = 1;

            try
            {
                count = Convert.ToInt16(this.tb_mbpage.Text.Trim());
            }
            catch
            {
                MessageAlert.Alert("请输入正确的数值!");
                return;
            }
            if (count > 0 && count <= CheckResultSetPage.TotalPage)
            {
                showdata(CheckResultSetPage.targetPage(count));
            }
            CheckResultSetPage.PageNo = count - 1;
            //this.tb_mbpage.Text = "1";
            this.Cursor = Cursors.Arrow;
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.AppStarting;
            if (wrenchchecklist == null || wrenchchecklist.Count <= 0)
            {
                MessageAlert.Alert("没有数据不能导出!");
                this.Cursor = Cursors.Arrow;
                return;
            }
            CheckDataOutExcel     cdoe           = new CheckDataOutExcel();
            SaveFileDialog        saveFileDialog = new SaveFileDialog();
            CheckDataOutExcelHelp _excelHelper   = new CheckDataOutExcelHelp();

            saveFileDialog.Filter = "Excel (*.XLS)|*.xls";
            if ((bool)(saveFileDialog.ShowDialog()))
            {
                try
                {
                    // _excelHelper.SaveToExcel(saveFileDialog.FileName, cdoe.ToTable (wrenchchecklist),"智能扭矩校验数据");


                    _excelHelper.SaveToExcel(saveFileDialog.FileName, cdoe.Header(wrenchchecklist), wrenchchecklist, "智能扭矩校验数据");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("导出失败:" + ex.Message);
                    this.Cursor = Cursors.Arrow;
                    return;
                }
                MessageBox.Show("导出成功");
                this.Cursor = Cursors.Arrow;
            }
        }
Beispiel #12
0
        public void OnRegisterButtonClick(View view)
        {
            if (String.IsNullOrEmpty(input_email?.Text))
            {
                var newFragment = new MessageAlert(Resources.GetText(Resource.String.emptyEmail));
                newFragment.Show(FragmentManager.BeginTransaction(), "dialog");
                return;
            }
            if (!IsValidEmail(input_email?.Text))
            {
                var newFragment = new MessageAlert(Resources.GetText(Resource.String.ERROR_INVALID_EMAIL));
                newFragment.Show(FragmentManager.BeginTransaction(), "dialog");
                return;
            }
            if (String.IsNullOrEmpty(input_password?.Text) || String.IsNullOrEmpty(input_password_confirm?.Text))
            {
                var newFragment = new MessageAlert(Resources.GetText(Resource.String.emptyPassword));
                newFragment.Show(FragmentManager.BeginTransaction(), "dialog");
                return;
            }
            if (input_password?.Length() < 6)
            {
                var newFragment = new MessageAlert(Resources.GetText(Resource.String.weakPassword));
                newFragment.Show(FragmentManager.BeginTransaction(), "dialog");
                return;
            }
            if (input_password?.Text != input_password_confirm?.Text)
            {
                var newFragment = new MessageAlert(Resources.GetText(Resource.String.passwordMistmatch));
                newFragment.Show(FragmentManager.BeginTransaction(), "dialog");
                return;
            }

            SignUpUser(input_email?.Text, input_password?.Text);
        }
Beispiel #13
0
        void savecheckset()
        {
            List <systemcheckset> ls = new List <systemcheckset>();

            try {
                systemcheckset s = new systemcheckset();
                s.throwvalue = Convert.ToDecimal(this.tb_throw.Text.Trim());
                // s.boundaryvalue = Convert.ToDecimal(this.tb_jmax .Text .Trim  ());
                s.count       = Convert.ToInt32(this.tb_jcount.Text.Trim());
                s.arry        = Convert.ToInt32(this.tb_jarry.Text.Trim());
                s.ishavejuser = (this.rb_true.IsChecked == null || this.rb_true.IsChecked == false) ? false : true;
                s.noticeshow  = (this.rb_show.IsChecked == null || this.rb_show.IsChecked == false) ? false : true;
                s.noticetime  = Convert.ToInt32(this.tb_hour.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_min.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_second.Text.Trim()).ToString("D2");
                s.noticedays  = this.tb_day.Text.Trim();
                ls.Add(s);
                if (SerializeXML <systemcheckset> .exit())
                {
                    SerializeXML <systemcheckset> .del();
                }
                SerializeXML <systemcheckset> .SaveList(ls);

                MessageAlert.Alert("设置成功!");
            }

            catch (Exception ex) { MessageAlert.Error("出错!" + ex); }
        }
Beispiel #14
0
        private void delbuttonclick(object sender, RoutedEventArgs e)
        {
            if (this.dataGrid1.SelectedIndex < 0)
            {
                return;
            }


            UserModel um = this.dataGrid1.SelectedItem as UserModel;

            if (um == null || um.guid == null)
            {
                return;
            }
            List <QDDL.Model.UserToRoleModel.usertorole> ut = new List <UserToRoleModel.usertorole>();

            ut = UserToRole.selectbyroleid(um.roleID, um.guid);
            if (ut.Count > 0)
            {
                if (!MessageAlert.Alter("是否删除该人员信息"))
                {
                    return;
                }
                if (UserToRole.delete(ut.FirstOrDefault()))
                {
                    userediter.BindUserModel(dataGrid1);
                    MessageAlert.Alert("删除成功!");
                }
            }
        }
        private void UpdateSupplierDetails(DbRepository dbRepository)
        {
            if (!ValidateRequiredFields())
            {
                return;
            }
            if (!ValidateDuplicateRecord())
            {
                return;
            }

            var repository       = dbRepository;
            var selectedSupplier = repository.Suppliers.GetById(GetSupplierId());

            {
                selectedSupplier.Email            = txtEmail.Text;
                selectedSupplier.ContactNo        = txtContactNo.Text;
                selectedSupplier.SupplierName     = txtSupplierName.Text;
                selectedSupplier.Address          = txtAddress.Text;
                selectedSupplier.DateTimeModified = DateTime.Now;
            };
            repository.Commit();

            MessageAlert.Show("Successfully Changed");
            ResetToDefault();
        }
Beispiel #16
0
        async void CreateUser()
        {
            Android.App.AlertDialog dialog = new SpotsDialog(this);
            dialog.Show();
            user = new User {
                Email       = auth.CurrentUser.Email,
                Id          = auth.CurrentUser.Uid.ToString(),
                FirstName   = firstName.Text,
                LastName    = lastName.Text,
                Country     = country.Text,
                City        = city.Text,
                DateOfBirth = dateOfBirth
            };
            var response = await AccountsApi.RegisterNew(user);

            if (response.Succeed)
            {
                LocalProvider.SetCurrentUser(user);
                StartActivity(new Intent(this, typeof(UserProfile)));
                Finish();
            }
            else
            {
                var newFragment = new MessageAlert(response.Errors);
                newFragment.Show(FragmentManager.BeginTransaction(), "dialog");
            }
            dialog.Dismiss();
        }
 wrench getwrench(wrench w)
 {
     try
     {
         w.wrenchCode    = this.tb_wrenchcode.Text.Trim();
         w.wrenchBarCode = this.tb_wrenchbarcode.Text.Trim();
         w.factory       = this.tb_factory.Text.Trim();
         w.rangeMax      = Convert.ToDecimal(this.tb_max.Text.Trim());
         w.rangeMin      = Convert.ToDecimal(this.tb_min.Text.Trim());
         w.comment       = this.tb_com.Text.Trim();
         w.offPset       = this.tb_Pset.Text.Trim();
         w.targetvalue   = Convert.ToDecimal(this.tb_targetvalue.Text.Trim());
         w.targetvalue1  = string.IsNullOrEmpty(this.tb_targetvalue1.Text.Trim()) ? 0 : Convert.ToDecimal(this.tb_targetvalue1.Text.Trim());
         w.targetvalue2  = string.IsNullOrEmpty(this.tb_targetvalue2.Text.Trim()) ? 0 : Convert.ToDecimal(this.tb_targetvalue2.Text.Trim());
         w.species       = (cb_species.SelectedItem as wrenchspecies).id.ToString();
         w.status        = (cb_status.SelectedItem as wrenchstatus).id.ToString();
         w.unit          = "N.m";
         w.createDate    = Convert.ToDateTime(Convert.ToDateTime(this.dp_time.Text.Trim()).ToString("s"));
         w.lastrepair    = Convert.ToDateTime(Convert.ToDateTime(this.dp_time_Copy.Text.Trim()).ToString("s"));
         return(w);
     }
     catch
     {
         MessageAlert.Alert("请输入正确的数字值!");
         return(null);
     }
 }
Beispiel #18
0
        public CustomLabel()
        {
            InitializeComponent();

            this.lblMaid.Click += delegate
            {
                List <Users> users = this.GetUserInGroup(this.note_calendar.group_maid);
                string       user  = "******";

                int cnt = 0;
                foreach (Users u in users)
                {
                    user += u.name + (++cnt < users.Count ? ", " : "");
                }

                MessageAlert.Show(user);
            };

            this.lblWeekend.Click += delegate
            {
                List <Users> users = this.GetUserInGroup(this.note_calendar.group_weekend);
                string       user  = "******";

                int cnt = 0;
                foreach (Users u in users)
                {
                    user += u.name + (++cnt < users.Count ? ", " : "");
                }

                MessageAlert.Show(user);
            };
        }
        private void bt_del_Click(object sender, RoutedEventArgs e)
        {
            if (this.lv_havefunctio.SelectedIndex < 0)
            {
                return;
            }
            if (lv_havefunctio.Items.Count > 0)
            {
                string tempstr = this.lv_havefunctio.SelectedItem as string;
                if ((cb_role.SelectedItem as role) != null && (cb_role.SelectedItem as role).roleName == "管理员")
                {
                    if (MessageAlert.Alter("是否删除管理员的该功能"))
                    {
                        tempstring.RemoveAt(tempstring.FindIndex(p => p == tempstr));
                    }
                }
                else
                {
                    tempstring.RemoveAt(tempstring.FindIndex(p => p == tempstr));
                }

                lv_havefunctio.ItemsSource = null;
                lv_havefunctio.ItemsSource = tempstring;
            }
        }
Beispiel #20
0
        private void BtLogin_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(this.tb_name.Text.Trim()) || String.IsNullOrEmpty(this.tb_password.Password.Trim()))
            {
                MessageAlert.Alert("用户名或密码不能为空!");
                return;
            }
            userlogin = new UserLogin(this.tb_name.Text.Trim(), this.tb_password.Password.Trim(), null);

            //if ((this.tb_name.Text.Trim() == "QDDL.com" && this.tb_password.Password.Trim() == "!@#$%^&*()"))
            //{
            //    showall();
            //    return;
            //}

            if ((userlogin.emplogin() == 1))
            {
                SystData.userInfo = userlogin._userinfo;
                Main main = new Main(ruc);
                Application.Current.MainWindow = main;
                this.Close();
                main.Show();
            }
            else
            {
                MessageAlert.Alert("登录名或密码错误!\n   登录失败!");
                // _m._userinfo = null;
                return;
            }
        }
Beispiel #21
0
        async void UpdateUser()
        {
            Android.App.AlertDialog dialog = new SpotsDialog(this);
            dialog.Show();
            try {
                user.FirstName = firstName.Text;
                user.LastName  = lastName.Text;
                user.Country   = country.Text;
                user.City      = city.Text;
                if (dateOfBirth != null)
                {
                    user.DateOfBirth = dateOfBirth;
                }

                var response = await AccountsApi.UpdateCurentUser(user);

                if (response.Succeed)
                {
                    LocalProvider.SetCurrentUser(user);
                    StartActivity(new Intent(this, typeof(UserProfile)));
                    Finish();
                }
                else
                {
                    var newFragment = new MessageAlert(response.Errors);
                    newFragment.Show(FragmentManager.BeginTransaction(), "dialog");
                }
            } catch (Exception ex) {
                System.Diagnostics.Debug.WriteLine($"{this.GetType().Name}: Exception: {ex.Message}");
            }
            dialog.Dismiss();
        }
        void showwrench(Toolinfo t)
        {
            if (t.wrench == null)
            {
                // tbempty();
                return;
            }
            //  this.tb_setvalue.Text = t.wrench.targetvalue.ToString("f1");
            //this.tb_bjb.Text = t.wrench.wrenchCode.ToString();
            this.tb_lc.Text = t.wrench.rangeMin.ToString("f1") + "~" + t.wrench.rangeMax.ToString("f1") + "N.m";
            // this.tb_xh.Text = t.wrench.factory.ToString();
            if (erl == null || erl.Count <= 0)
            {
                MessageAlert.Alert("没有任何扳手误差设置!\n     无法校验!");
                return;
            }
            List <errorrangset> tm = erl.Where(p => p.speciesID == t.wrench.species).ToList();

            foreach (errorrangset e in tm)
            {
                if (e.rangmax > t.wrench.targetvalue && e.rangmin <= t.wrench.targetvalue)
                {
                    this.tb_jywm.Text = e.errorrangMax.ToString();
                    this.tb_jyw.Text  = e.errorrangMin.ToString();
                }
            }
            this.lb_status.Content = "工具信息获取成功!";
        }
        bool IsUpdataRepeat(role r)
        {
            GetRole     gr     = new GetRole();
            List <role> rl     = gr.getrole();
            List <role> temprl = rl.FindAll(p => p.roleName == r.roleName);

            foreach (role re in temprl)
            {
                if (re != null && re.guid != r.guid)
                {
                    MessageAlert.Alert("该名称已经存在!");
                    return(true);
                }
            }
            temprl = rl.FindAll(p => p.roleDM == r.roleDM);
            foreach (role re in temprl)
            {
                if (re != null && re.guid != r.guid)
                {
                    MessageAlert.Alert("该编号已经存在!");
                    return(true);
                }
            }
            return(false);
        }
        private void BtLogin_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.pb_name.Password) || string.IsNullOrEmpty(this.pb_password.Password) || string.IsNullOrEmpty(this.pb_qpwd.Password))
            {
                MessageAlert.Warning("请输入必要信息! * 为必填信息"); return;
            }

            if (!SystData.userInfo.user.password.Equals(MD5Encrypt.GetMD5(this.pb_name.Password)))
            {
                MessageAlert.Warning("输入密码和登录密码不匹配!");
                return;
            }
            if (!this.pb_password.Password.Equals(this.pb_qpwd.Password))
            {
                MessageAlert.Warning("新密码和确认密码不一致!");
                return;
            }
            try
            {
                if (_m != null)
                {
                    SystData.userInfo.user.password = MD5Encrypt.GetMD5(this.pb_qpwd.Password);
                    if (User.Update(SystData.userInfo.user))
                    {
                        MessageAlert.Alert("密码更新成功!");
                    }
                    else
                    {
                        MessageAlert.Alert("密码更新失败!");
                    }
                }
            }
            catch (Exception ex) { MessageAlert.Alert(ex.ToString()); }
        }
Beispiel #25
0
        private void SaveNewAccount(DbRepository userRepository)
        {
            if (!ValidateRequiredFields())
            {
                return;
            }
            if (!ValidateDuplicateRecord())
            {
                return;
            }


            var repository = userRepository;

            var newAccount = new User()
            {
                Name            = txtName.Text,
                Password        = txtPassword.Text,
                RoleId          = (int)txtUserRole.SelectedValue,
                Username        = txtUsername.Text,
                IsActive        = true,
                DateTimeCreated = DateTime.Now
            };

            repository.Users.Add(newAccount);
            repository.Commit();
            MessageAlert.Show("Successfully Saved");
            ResetToDefault();
        }
        private async void Delete()
        {
            if (!Global.HasRight("1003"))
            {
                MessageAlert.Alert("权限不足!");
                return;
            }
            if (SelectRecord == null)
            {
                MessageAlert.Alert("请选择要删除的记录!");
                return;
            }
            var confirm = await MessageAlert.Confirm("确定删除此记录?");

            if (!confirm)
            {
                return;
            }
            ToolRecordDao dao = new ToolRecordDao();
            var           rlt = dao.DeleteToolRecord(SelectRecord.Id);

            if (rlt.HasError)
            {
                MessageAlert.Alert(rlt.Msg);
            }
            RefreshList(null);
        }
Beispiel #27
0
        private void del_Click(object sender, RoutedEventArgs e)
        {
            var c = tvProperties.SelectedItem as PropertyNodeItem;

            if (c == null)
            {
                MessageAlert.Alert("请先选择要操作的部门");
                return;
            }

            department d = new department();

            if (c.Children.Count > 0)
            {
                MessageAlert.Alert("该部门存在子部门\n不能删除!");
                return;
            }
            if (MessageAlert.Alter("是否删除!"))
            {
                d = Department.SelectById(c.id.ToString());
                d.delDepartment = true;
                if (Department.Update(d))
                {
                    MessageAlert.Alert("删除成功!");
                }
            }
            lt.TreeLoad();
            this.dataGrid1.ItemsSource = GetDepartmentModel();
        }
        private void SaveSupplierDetails(DbRepository dbRepository)
        {
            if (!ValidateRequiredFields())
            {
                return;
            }
            if (!ValidateDuplicateRecord())
            {
                return;
            }

            var repository = dbRepository;
            var supplier   = new Models.Supplier()
            {
                SupplierName    = txtSupplierName.Text,
                ContactNo       = txtContactNo.Text,
                Email           = txtEmail.Text,
                Address         = txtAddress.Text.Trim(),
                IsActive        = true,
                DateTimeCreated = DateTime.Now


                                  //CreatedBy = AccountSession.GetAccount.Id
            };

            repository.Suppliers.Add(supplier);
            repository.Commit();

            ResetToDefault();
            MessageAlert.Show("New supplier has successfully added.", "Supplier", AlertType.Info);
        }
Beispiel #29
0
        static void Main()
        {
            try
            {
                Application.ThreadException += Application_ThreadException;
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Main());
            }
            catch (Exception ex)
            {
                string str         = "";
                string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now.ToString() + "\r\n";

                if (ex != null)
                {
                    str = string.Format(strDateInfo + "异常类型:{0}\r\n异常消息:{1}\r\n异常信息:{2}\r\n",
                                        ex.GetType().Name, ex.Message, ex.StackTrace);
                }
                else
                {
                    str = string.Format("应用程序线程错误:{0}", ex);
                }
                log.Error(str);
                MessageAlert alert = new MessageAlert("发生致命错误,请及时联系客户!", "系统错误");
                alert.ShowDialog();
            }
        }
 bool SaveDate()
 {
     if (borrowwrenchlist == null || borrowwrenchlist.Count <= 0)
     {
         MessageAlert.Alert("没有数据");
         return(false);
     }
     try
     {
         foreach (BorrowWrench b in borrowwrenchlist)
         {
             borrow bw = new borrow()
             {
                 WrenchID       = b.wrenchid,
                 borrowUser     = b.userguid,
                 borrowDate     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                 borrowOperator = b.operatorguid,
                 guid           = Guid.NewGuid().ToString(),
                 is_return      = false
             };
             Borrow.add(bw);
         }
     }
     catch { return(false); }
     return(true);
 }