Esempio n. 1
0
        public void updateTest()
        {
            using (TransactionScope ts = new TransactionScope())//使整个代码块成为事务性代码

            {
                AuthDAO dao = new AuthDAO();
                Auther  a   = dao.Load(2);
                a.Auth_UserName = "******";
                dao.UpdateByPrimaryKey(a);
                //插入至上传表
                UploadManagementDAO uploadManagementDao1 = new UploadManagementDAO();
                uploadManagementDao1.Insert(new UploadManagement(a.Pk_Auth_Id, "bdl_auth", 1));

                Auther b = new Auther();
                b.Auth_UserName = "******";
                dao.Insert(b);
                //插入至上传表
                UploadManagementDAO uploadManagementDao = new UploadManagementDAO();
                uploadManagementDao.Insert(new UploadManagement(b.Pk_Auth_Id, "bdl_auth", 0));

                int p = 0;
                //int l = 8 / p;

                ts.Complete();
            }
        }
Esempio n. 2
0
        private void Button_OK(object sender, RoutedEventArgs e)
        {
            string PassWord = "";

            if (UserName.Text != null && UserName.Text != "")
            {
                auther.Auth_UserName = UserName.Text;
            }
            else
            {
                MessageBoxX.Info(LanguageUtils.ConvertLanguage("用户名不能为空", "The username can not be empty"));
            }
            auther.Gmt_Create   = DateTime.Now;
            auther.Gmt_Modified = DateTime.Now;
            if ((bool)Yes.IsChecked)
            {
                DateTime           date     = (DateTime)Auther.Auth_OFFLINETIMEFREE;
                string             sdate    = string.Format("{0:yyyy-MM-dd}", date);
                DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
                dtFormat.ShortDatePattern = "yyyy-MM-dd";
                auther.Auth_OfflineTime   = Convert.ToDateTime(sdate, dtFormat);
                auther.User_Status        = 2;
                this.Close();
            }
            else
            {
                if (Confirm_Date.SelectedDate == null)
                {
                    MessageBoxX.Info(LanguageUtils.ConvertLanguage("离线时间不能为空", "The offlinetime can not be empty"));
                }
                else
                {
                    auther.Auth_OfflineTime = Confirm_Date.SelectedDate;
                    auther.User_Status      = 0;
                }
            }
            PassWord = Pass.Password;

            string REPassword = Confirm_Pass.Password;

            auther.Auth_Level = 0x01;
            if (UserName.Text != "" && auther.User_Status != null && PassWord.Equals(REPassword) && PassWord != "")
            {
                auther.Auth_UserPass = PassWord;
                authDAO.Insert(auther);
                this.Close();
            }
            else if (UserName.Text != "" && PassWord == "")
            {
                MessageBoxX.Info(LanguageUtils.ConvertLanguage("密码不能为空", "The password can not be empty"));
            }
            else if (!PassWord.Equals(REPassword))
            {
                MessageBoxX.Info(LanguageUtils.ConvertLanguage("密码的两次输入不一致", "Two inconsistencies in the password are inconsistencies"));
            }
        }