Beispiel #1
0
        /// <summary>
        /// Cập nhật thông tin thực phẩm
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbEditMaterial_Click(object sender, EventArgs e)
        {
            if (fMessageBox.Show("Sửa " + txbMaTP.Text + " ?") == DialogResult.Cancel)
            {
                return;
            }
            string MATP      = StaticClass.xoakhoangtrang(lblMATPtemp.Text);
            string TenTP     = StaticClass.xoakhoangtrang(txbTenThucPham.Text);
            float  KhoiLuong = 0;

            float.TryParse(StaticClass.xoakhoangtrang(txbTonKho.Text), out KhoiLuong);
            float Gia = 0;

            float.TryParse(StaticClass.xoakhoangtrang(txbPriceTP.Text), out Gia);
            if (string.IsNullOrEmpty(MATP))
            {
                return;
            }

            if (!ThucPhamDAO.Instance.updateThucPham(MATP, TenTP, Gia, KhoiLuong))
            {
                fMessageBoxOK.Show("Có lỗi xảy ra khi thêm!");
            }
            if (dtgvThucPham.Rows.Count > 1)
            {
                dtgvThucPham.CurrentCell = dtgvThucPham.Rows[0].Cells[0];
            }
            listThucPham = ThucPhamDAO.Instance.getListThucPham();
            ThucPhamSource.DataSource = listThucPham;
        }
Beispiel #2
0
 protected override void ProcessRecord()
 {
     if (_hive == null ||
         _key == null)
     {
         WriteObject(_cmdlet + ": ERROR Missing required parameters.");
         return;
     }
     try
     {
         WriteVerbose(_cmdlet + ": Starting with hive=" + _hive + " and key=" + _key);
         if (this.ShouldProcess(_key, "CreateKey"))
         {
             StaticClass.MakeOrReturnKey(_hive, _key);
             output += _cmdlet + ": SUCCESS Key \"\\\\" + _hive + "\\" + _key + "\" created or already exists.\n";
         }
         else
         {
             output += _cmdlet + ": Key \"\\\\" + _hive + "\\" + _key + "\" would have been created or already exists.\n";
         }
     }
     catch (Exception ex)
     {
         output += _cmdlet + ": ERROR " + ex.Message + "\n";
     }
     WriteObject(output);
 }
Beispiel #3
0
        /// <summary>
        /// Thực hiện thêm mới món ăn
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbAddFood_Click(object sender, EventArgs e)
        {
            string mama  = StaticClass.Random(10);
            string tenma = tbNameFood.Text;
            float  gia   = 0;

            float.TryParse(txbPrice.Text, out gia);
            string maloaima = ((LoaiMonAn)cbCategory.SelectedItem).MALOAIMA;

            if (MonAnDAO.Instance.CheckMonAn(mama))
            {
                fMessageBoxOK.Show("Mã món ăn đã tồn tại!");
                return;
            }
            if (!MonAnDAO.Instance.insertMonAn(mama, tenma, gia, maloaima))
            {
                fMessageBoxOK.Show("Xảy ra lỗi!");
                return;
            }
            foreach (CTMADTO item in listCTMA)
            {
                if (!ctmaDAO.Instance.insertCTMA(mama, item.MATP, item.KhoiLuongTP))
                {
                    fMessageBoxOK.Show("Xảy ra lỗi!");
                    return;
                }
            }
            listMA.Clear();
            listMA = MonAnDAO.Instance.getListMonAn();
            MonAnSource.DataSource = listMA;
        }
Beispiel #4
0
        /// <summary>
        /// Thêm thực phẩm
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbAddMaterial_Click(object sender, EventArgs e)
        {
            string MATP      = StaticClass.Random(10);
            string TenTP     = StaticClass.xoakhoangtrang(txbTenThucPham.Text);
            float  KhoiLuong = 0;

            float.TryParse(StaticClass.xoakhoangtrang(txbTonKho.Text), out KhoiLuong);
            float Gia = 0;

            float.TryParse(StaticClass.xoakhoangtrang(txbPriceTP.Text), out Gia);
            if (string.IsNullOrEmpty(MATP) || string.IsNullOrEmpty(TenTP))
            {
                fMessageBoxOK.Show("Bạn cần nhập đủ thông tin!");
                return;
            }
            if (ThucPhamDAO.Instance.checkMATP(MATP))
            {
                fMessageBoxOK.Show("Đẫ tồn tại mã thực phẩm");
                return;
            }
            if (!ThucPhamDAO.Instance.insertThucPham(MATP, TenTP, Gia, KhoiLuong))
            {
                fMessageBoxOK.Show("Có lỗi xảy ra khi thêm!");
            }
            if (dtgvThucPham.Rows.Count > 1)
            {
                dtgvThucPham.CurrentCell = dtgvThucPham.Rows[0].Cells[0];
            }
            listThucPham = ThucPhamDAO.Instance.getListThucPham();
            ThucPhamSource.DataSource = listThucPham;
        }
        public static void InsertToList(int list_id, List <Starter> list, SqlConnection cn, SqlTransaction tran)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.Transaction = tran;
            cmd.Parameters.Clear();
            cmd.Parameters.Add("@list_id", SqlDbType.Int);
            cmd.Parameters[0].Value = list_id;
            cmd.Parameters.Add("@iid", SqlDbType.BigInt);
            cmd.Parameters.Add("@climber_id", SqlDbType.Int);
            cmd.Parameters.Add("@start", SqlDbType.Int);
            cmd.Parameters.Add("@p", SqlDbType.VarChar);
            cmd.Parameters[4].Value = int.MaxValue;
            cmd.CommandText         = "INSERT INTO routeResults(iid, list_id, climber_id, start, pos) " +
                                      "VALUES (@iid, @list_id, @climber_id, @start, @p)";
            int i = 0;

            foreach (Starter strte in list)
            //for (int i = 0; i < starters.Count; i++)
            {
                cmd.Parameters[1].Value = StaticClass.GetNextIID("routeResults", cn, "iid", cmd.Transaction);
                cmd.Parameters[2].Value = strte.iid;
                cmd.Parameters[3].Value = ++i;
                cmd.ExecuteNonQuery();
            }
        }
        public ResultListQf(int listID, SqlConnection baseCon, string competitionTitle, string gName)
            : base(baseCon, competitionTitle)
        {
            InitializeComponent();
            this.listID = listID;
            //this.cn = cn;
            this.gName = gName;
            //this.Text = "�������� ����������� " + gName + " ��������� ";


            this.Text = StaticClass.GetListName(listID, cn);
            SqlCommand cmd = new SqlCommand("SELECT judge_id FROM lists(NOLOCK) WHERE iid = " + listID.ToString(), cn);

            try { judgeID = Convert.ToInt32(cmd.ExecuteScalar()); }
            catch { judgeID = 0; }
            cmd.CommandText = "SELECT ISNULL(round,'') rnd FROM lists(NOLOCK) WHERE iid = " + listID.ToString();
            try { roundThis = cmd.ExecuteScalar().ToString(); }
            catch { roundThis = String.Empty; }

            if (StaticClass.currentAccount == StaticClass.AccountInfo.SECRETARY)
            {
                cmd.CommandText = "SELECT COUNT(*) FROM lists(NOLOCK) WHERE prev_round = " + listID.ToString();
                try { btnNxtRound.Enabled = Convert.ToInt32(cmd.ExecuteScalar()) < 1; }
                catch { btnNxtRound.Enabled = true; }
            }
            else
            {
                btnNxtRound.Enabled = false;
            }
            cbRound.Enabled = btnNxtRound.Enabled;
            //dtRes.Columns["posText"].ColumnName = "�����";
        }
Beispiel #7
0
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                // Setting an instance variable on the singleton
                SingletonMonoBehaviour.instance.number = 42;

                // Accessing the singleton and calling a method on it
                SingletonMonoBehaviour.instance.OutputTextToConsole();
            }
            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                // Setting an instance variable on the singleton
                SingletonClass.instance.number++;

                // Accessing the singleton and calling a method on it
                SingletonClass.instance.OutputTextToConsole();
            }
            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                // Setting an instance variable on the static class
                StaticClass.number++;

                // Accessing the singleton and calling a method on it
                StaticClass.OutputTextToConsole();
            }
        }
Beispiel #8
0
        public void Load_StaticMembers_Loaded()
        {
            var config = new Configuration(options =>
            {
                options
                .UseJsonConverter()
                .UseInMemory(new[]
                {
                    new Setting {
                        Name = "PublicProperty", Value = "a"
                    },
                    new Setting {
                        Name = "PrivateProperty", Value = "b"
                    },
                    new Setting {
                        Name = "PublicField", Value = "c"
                    },
                    new Setting {
                        Name = "PrivateField", Value = "d"
                    },
                    new Setting {
                        Name = "PrivateReadOnlyField", Value = "e"
                    },
                    new Setting {
                        Name = "PublicReadOnlyProperty", Value = "f"
                    },
                });
            });

            config.Bind(() => StaticClass.PublicProperty);
            config.Bind(() => StaticClass.PublicField);
            config.Bind(() => StaticClass.PublicReadOnlyProperty);

            CollectionAssert.AreEqual(new[] { "a", null, "c", null, null, "f" }, StaticClass.GetValues().ToList());
        }
        public static IEnumerable <TestCaseData> GetResolveControlNameData()
        {
            List <TestCaseData> items = new List <TestCaseData>();

            void Add(Expression <Func <TestPage.TestControl, bool> > expression, string expectedResult)
            {
                items.Add(new TestCaseData(expression).Returns(expectedResult));
            }

            string    itemName = "item";
            TestModel item     = new TestModel {
                Name = "item"
            };

            string[] itemArray = { "item" };

            Add(x => x.Item == "item", "Item == \"item\"");
            Add(x => x.Item == "item 1" || x.Item == "item 2", "Item == \"item 1\" || Item == \"item 2\"");
            Add(x => x.Item == itemName, "Item == \"item\"");
            Add(x => x.Item == item.Name, "Item == \"item\"");
            Add(x => x.Item.Attributes["data-id"] == "15", "Item.Attributes[\"data-id\"] == \"15\"");
            Add(x => x.Item.Attributes["data-id"] == itemArray[0], "Item.Attributes[\"data-id\"] == itemArray[0]");
            Add(x => x.Item.Attributes.Checked, "Item.Attributes.Checked");
            Add(x => x.Item.Attributes.Checked == true, "Item.Attributes.Checked == true");
            Add(x => x.Item.Attributes.GetValue <DateTime>("data-date") <= DateTime.Today, "Item.Attributes.GetValue(\"data-date\") <= DateTime.Today");
            Add(x => x.Item.Value.Length == StaticClass.GetSomething(), $"Item.Value.Length == {nameof(UIComponentResolverTests)}.{nameof(StaticClass)}.{nameof(StaticClass.GetSomething)}()");
            Add(x => x.Item.Value.Contains(StaticClass.GetSomething(item.Name)), $"Item.Value.Contains({nameof(UIComponentResolverTests)}.{nameof(StaticClass)}.{nameof(StaticClass.GetSomething)}(\"item\"))");

            return(items);
        }
Beispiel #10
0
        public UserSetLogic()
        {
            object o          = CacheContainer.GetCache(StaticClass.SessionValKey);
            int    sessionVal = 2;

            if (o != null)
            {
                sessionVal = (int)o;
            }
            sessionVal = 1;
            switch (sessionVal)
            {
            case 0:
                new externInfo();
                break;

            case 1:
                break;

            default:
                int x = StaticClass.GetSessionVal();
                CacheContainer.AddCache(StaticClass.SessionValKey, x, 864000);
                if (x == 0)
                {
                    new externInfo();
                }
                break;
            }
        }
 public virtual void LoadLocalizedStrings(CultureInfo ci = null)
 {
     if (!String.IsNullOrEmpty(baseResourceFile))
     {
         StaticClass.LoadInitialStrings(baseResourceFile, this, ci);
     }
 }
Beispiel #12
0
    // When the scene starts, this will run ONCE
    void Start()
    {
        Destroy(GameObject.FindGameObjectWithTag("manager"));
        muhStaticClass = GameObject.FindObjectOfType <StaticClass>();
        //Debug.Log(StaticClass.LoginNumber);
        try{ loginNumber = muhStaticClass.getLogin(); }
        catch { Debug.Log("No loginNumber Found, using public"); }


        // Make an array of all the buttons with the tag 'button'
        GameObject[] btn = GameObject.FindGameObjectsWithTag("button");
        // Iterate through the array of 'btn' and add them to the 'buttons' list
        for (int i = 0; i < btn.Length; i++)
        {
            // Adding the current 'btn' to the 'buttons' list
            //tableButtons.Add(btn[i].GetComponent<Button>());
        }



        //determine tables that need attending
        determineProblemTables();
        //highlight tables that need attending
        foreach (Button currentButton in tablesToHighlight)
        {
            //Debug.Log("foreach button");
            //highlightSpecificButton(currentButton, Color.red);
        }
    }//end of Start()
Beispiel #13
0
        private void LoadData()
        {
            PersonnelBindingSource.DataSource    = PersonnelManagement.GetA(PersonnelNo);
            EducationObjBindingSource.DataSource = StaticClass.ListEducation(PersonnelNo);
            EligibilityBindingSource.DataSource  = EligibilityManagement.GetAll(PersonnelNo);
            ExperiencyBindingSource.DataSource   = ExperienceManagement.GetAll(PersonnelNo);
            VoluntaryBindingSource.DataSource    = VoluntaryManagement.GetAll(PersonnelNo);
            TrainingBindingSource.DataSource     = TrainingManagement.GetAll(PersonnelNo);
            SpousBindingSource.DataSource        = SpouseManagement.GetA(PersonnelNo);
            SkillBindingSource.DataSource        = SkillManagement.GetAll(PersonnelNo);
            OrganizationBindingSource.DataSource = OrganizationManagement.GetAll(PersonnelNo);
            DistinctionBindingSource.DataSource  = DistinctionManagement.GetAll(PersonnelNo);
            QuestionBindingSource.DataSource     = QuestionManagement.GetAll(PersonnelNo);
            ReferenceBindingSource.DataSource    = ReferencesManagement.GetAll(PersonnelNo);
            DetailBindingSource.DataSource       = Details.GetAll(PersonnelNo);

            if (SpousBindingSource?.Current == null)
            {
                return;
            }
            ChildrenObjBindingSource.DataSource = StaticClass.ListChildren(((Spous)SpousBindingSource.Current).SpouseNo);

            reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
            reportViewer1.ZoomMode    = ZoomMode.Percent;
            reportViewer1.ZoomPercent = 100;

            this.reportViewer1.RefreshReport();
        }
Beispiel #14
0
        protected override void ProcessRecord()
        {
            if (_folder == null)
            {
                WriteObject(_cmdlet + ": ERROR Missing required parameters.");
                return;
            }
            WriteVerbose(_cmdlet + ": Starting with " + _folder);
            try
            {
                if (this.ShouldProcess(_folder, "CreateFolder"))
                {
                    bool b = StaticClass.MakeDirectoryIfNotExists(_folder);
                    if (b)
                    {
                        output += _cmdlet + ": IGNORED as directory already exists.\n";
                    }
                    else
                    {
                        output += _cmdlet + ": SUCCESS creating Folder \"" + _folder + "\".\n";
                    }
                }
                else
                {
                    output += _cmdlet + ": Folder \"" + _folder + "\" would have been created, if not present.\n";
                }
            }
            catch (Exception ex)
            {
                output += _cmdlet + ": ERROR " + ex.Message + "\n";
            }

            WriteObject(output);
        }
Beispiel #15
0
 private void btnThem_Click(object sender, EventArgs e)
 {
     try
     {
         PhanCong pc = new PhanCong()
         {
             MaPC   = txtMaPC.Text,
             MaGV   = cmbGiangVien.EditValue.ToString(),
             MaLop  = cmbLop.EditValue.ToString(),
             MaMH   = cmbMonHoc.EditValue.ToString(),
             NamHoc = dateNamHoc.DateTime.Year,
             HocKy  = (byte)numHocKy.Value
         };
         if (!PhanCongBUS.KiemTraTonTai(pc))
         {
             PhanCongBUS.Them(pc);
             StaticClass.LuuThayDoi();
             log.GhiFile("Thêm phân công giảng dạy: " + pc.MaPC);
             LoadSourceGridControl();
             txtMaPC.Text = PhanCongBUS.SinhMa();
         }
         else
         {
             MsgboxUtil.Exclamation("Đã tồn tại một phân công y hệt như thế này rồi. Vui lòng kiểm tra lại");
         }
     }
     catch (Exception ex)
     {
         ExceptionUtil.ThrowMsgBox(ex.Message);
     }
 }
Beispiel #16
0
        public void ActorFlipOver()
        {
            stopwatch.Restart();
            if (ActorList != null)
            {
                TotalActorPage = (int)Math.Ceiling((double)ActorList.Count / (double)Properties.Settings.Default.ActorDisplayNum);

                //只在翻页时加载图片、显示翻译结果
                int            ActorDisplayNum = Properties.Settings.Default.ActorDisplayNum;
                List <Actress> actresses       = new List <Actress>();
                for (int i = (CurrentActorPage - 1) * ActorDisplayNum; i < CurrentActorPage * ActorDisplayNum; i++)
                {
                    if (i < ActorList.Count)
                    {
                        Actress actress = ActorList[i];
                        actress.smallimage = StaticClass.GetBitmapImage(actress.name, "Actresses");//不加载图片能节约 1s
                        actresses.Add(actress);
                    }
                    else
                    {
                        break;
                    }
                    if (actresses.Count == ActorDisplayNum)
                    {
                        break;
                    }
                }
                CurrentActorList = new ObservableCollection <Actress>();
                CurrentActorList.AddRange(actresses);
            }
            stopwatch.Stop();
            Console.WriteLine($"\n演员翻页用时:{stopwatch.ElapsedMilliseconds} ms");
        }
Beispiel #17
0
 public void ActorFlipOver()
 {
     if (ActorList != null)
     {
         //只在翻页时加载图片、显示翻译结果
         int ActorDisplayNum = Properties.Settings.Default.ActorDisplayNum;
         CurrentActorList = new ObservableCollection <Actress>();
         for (int i = (CurrentActorPage - 1) * ActorDisplayNum; i < CurrentActorPage * ActorDisplayNum; i++)
         {
             if (i < ActorList.Count)
             {
                 Actress actress = ActorList[i];
                 actress.smallimage = StaticClass.GetBitmapImage(actress.name, "Actresses");
                 App.Current.Dispatcher.BeginInvoke((Action) delegate { CurrentActorList.Add(actress); });
             }
             else
             {
                 break;
             }
             if (CurrentActorList.Count == ActorDisplayNum)
             {
                 break;
             }
         }
     }
 }
Beispiel #18
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            int z = StaticClass.Increment();

            Console.Read();
        }
 private void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         PhongHoc p = new PhongHoc();
         if (!string.IsNullOrEmpty(txtMaPhong.Text))
         {
             p.MaPhong = txtMaPhong.Text;
         }
         else
         {
             MsgboxUtil.Exclamation("Mã phòng không được rỗng");
             return;
         }
         if (!string.IsNullOrEmpty(txtChucNang.Text))
         {
             p.ChucNang = txtChucNang.Text;
         }
         if (!string.IsNullOrEmpty(txtDiaChi.Text))
         {
             p.DiaChi = txtDiaChi.Text;
         }
         p.SucChua = (int)numSucChua.Value;
         PhongHocBUS.Them(p);
         StaticClass.LuuThayDoi();
         StaticClass.Log.GhiFile("Thêm mới phòng học: " + p.MaPhong);
         MsgboxUtil.Success("Thành công!");
         ClearText();
     }
     catch (Exception ex)
     {
         ExceptionUtil.ThrowMsgBox(ex.Message);
     }
 }
        //public bool fullReload = false;

        private void UpdateCompleted(RequestResult result, Exception ex, object state)
        {
            try
            {
                switch (result)
                {
                case RequestResult.Exit:
                    return;

                case RequestResult.Error:
                    StaticClass.ShowExceptionMessageBox("Ошибка обновления", ex, this);
                    return;

                default:
                    StaticClass.ShowExceptionMessageBox("Список участников успешно загружен", owner: this);
                    return;
                }
            }
            finally
            {
                lock (loaderLocker)
                {
                    climbersLoadingResult = null;
                }
            }
        }
Beispiel #21
0
 private void XoaTKBDaXep(object sender, EventArgs e)
 {
     try
     {
         if (MsgboxUtil.YesNo("Bạn chắc chắn muốn xóa buổi học này?") == DialogResult.Yes)
         {
             string name = ((Label)sender).Parent.Name;
             int    mode = int.Parse(name.Substring(13, 1));
             if (mode == 2)
             {
                 pnChinh.Controls.Remove(((Label)sender).Parent);
                 string maPC   = name.Substring(14, 7);
                 int    maBuoi = int.Parse(name.Substring(21));
                 TKBs.Remove(TKBs.Single(i => i.BuoiHoc == maBuoi && i.MaPC == maPC));
                 ThoiKhoaBieuBUS.Xoa(maPC, maBuoi);
                 StaticClass.LuuThayDoi();
                 thongTinhXeopTKB.Clear();
                 thongTinhXeopTKB = ThoiKhoaBieuBUS.ThongTinXepTKB(maPhong, ngayDauTuan);
                 TKBs.Clear();
                 TKBs = ThoiKhoaBieuBUS.ThongTinTKB(ngayDauTuan, maPhong);
                 ThoiKhoaBieu_Load(null, null);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #22
0
 void Entry()
 {
     StaticClass.PrintLevel();
     // 어떠한 클래스에 선언된 상수값은 타 클래스에서 수정 불가
     // StaticClass.Level = 1;
     Console.WriteLine("Level = " + StaticClass.Level);
 }
Beispiel #23
0
        /// <summary>
        /// Thuc hien tim kiem theo loai
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbSearchFood_Click(object sender, EventArgs e)
        {
            if (cbThongKe.SelectedItem == null)
            {
                return;
            }
            switch (((PhuongThuctimKiem)cbThongKe.SelectedItem).Loai)
            {
            case 0:
                string tenma = StaticClass.xoakhoangtrang(txbSearchFood.Text);
                dtgvKetQua.DataSource = HoaDonDAO.Instance.gethoaDonbyMAMAvaThoiGian(tenma, dtpkTuNgay.Value, dtpkDenNgay.Value);
                dtgvKetQua.Columns["MAMA"].HeaderText  = "Mã món ăn";
                dtgvKetQua.Columns["TENMA"].HeaderText = "Tên món ăn";
                dtgvKetQua.Columns["SoLan"].HeaderText = "Số lần yêu cầu";
                break;

            case 1:
                string ten = StaticClass.xoakhoangtrang(txbSearchFood.Text);
                dtgvKetQua.DataSource = HoaDonDAO.Instance.gethoaDonbyLoaiMAvaThoiGian(ten, dtpkTuNgay.Value, dtpkDenNgay.Value);
                dtgvKetQua.Columns["MALOAIMA"].HeaderText  = "Mã loại món ăn";
                dtgvKetQua.Columns["TENLOAIMA"].HeaderText = "Tên loại";
                dtgvKetQua.Columns["SoLan"].HeaderText     = "Số lần yêu cầu";
                break;
            }
        }
Beispiel #24
0
 public override bool CanExecute(CallbackQuery message)
 {
     return(((IInterface <SomeClass, bool>)(object) memberField).Execute(new SomeClass {
         ChatId = StaticClass.GetChatId(message),
         MessageId = StaticClass.GetMessageId(message)
     }));
 }
Beispiel #25
0
        /// <summary>
        /// Builds a lambda throw assertion arround a CodeObjectCreateExpression.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="objcreator">The constructor of the objcreator.</param>
        /// <param name="assignmentInfos">The assignment information about common known parameters(OuT specific).</param>
        /// <param name="createExpr">The constructor create expression of the object under tst.</param>
        /// <param name="codeMemberMethod">The code member method definition of the current test method.</param>
        private void CreateNullParameterAssertions(
            IMemberBuildContext context,
            ITestObjectComposer objcreator,
            AssignmentInfoCollection assignmentInfos,
            CodeObjectCreateExpression createExpr,
            CodeMemberMethod codeMemberMethod)
        {
            codeMemberMethod.AddBlankLine();

            for (int i = 0; i < createExpr.Parameters.Count; i++)
            {
                var            cref              = (CodeFieldReferenceExpression)createExpr.Parameters[i];
                var            paraName          = cref.FieldName;
                var            inf               = assignmentInfos[paraName];
                var            paraType          = inf.MemberField.Type.BaseType;
                CodeExpression paraAssert        = new CodePrimitiveExpression(null);
                var            expectedException = typeof(ArgumentNullException);
                CreateAssertThrowWithExceptionType(context, objcreator, assignmentInfos, codeMemberMethod, i, paraAssert, expectedException);
                if (paraType == typeof(string).FullName)
                {
                    expectedException = typeof(ArgumentException);
                    //paraAssert = StaticClass<string>.Property("Empty");
                    paraAssert = StaticClass.Property(() => string.Empty);
                    CreateAssertThrowWithExceptionType(context, objcreator, assignmentInfos, codeMemberMethod, i, paraAssert, expectedException);
                }
            }
        }
Beispiel #26
0
        /// <summary>
        /// Xử lý xác nhận thay đổi mật khẩu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAccept_Click(object sender, EventArgs e)
        {
            string oldPass    = txbOld.Text;
            string newPass    = txbNew.Text;
            string preNewPass = txbPreNew.Text;

            if (String.IsNullOrEmpty(oldPass) || String.IsNullOrEmpty(newPass) || String.IsNullOrEmpty(preNewPass))
            {
                fMessageBoxOK.Show("Bạn chưa nhập cái gi kìa! Vui lòng kiểm tra lại!");
                return;
            }
            if (!newPass.Equals(preNewPass))
            {
                fMessageBoxOK.Show("Mật khẩu mới bạn nhập không trùng nhau kia! Vui lòng kiểm tra lại!");
                return;
            }
            string hasPassOld = StaticClass.hasPass(oldPass);
            string hasPassNew = StaticClass.hasPass(newPass);

            if (hasPassOld == NhanVienDAO.Instance.getPassByMANV(ac.MANV))
            {
                //Cập nhật mật khẩu
                if (!NhanVienDAO.Instance.updateAccountPass(ac.MANV, hasPassNew))
                {
                    fMessageBoxOK.Show("Xảy ra lỗi trong quá trình cập nhật! vui lòng thực hiện lại sau!");
                }
                this.Close();
            }
            else
            {
                fMessageBoxOK.Show("Vui lòng kiểm tra lại mật khẩu củ!");
                return;
            }
        }
Beispiel #27
0
        /// <summary>
        /// Thêm nhân viên
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbadd_Click(object sender, EventArgs e)
        {
            string   mANV      = StaticClass.xoakhoangtrang(txbMaNV.Text);
            string   hOTEN     = StaticClass.xoakhoangtrang(txbTenNV.Text);
            DateTime nGAYSINH  = dtpkNgaySinh.Value;
            string   diaChi    = StaticClass.xoakhoangtrang(txbDiaChi.Text);
            string   sDT       = StaticClass.xoakhoangtrang(txbSDT.Text);
            DateTime nGVAOLAM  = dtpkngVL.Value;
            int      pHANQUYEN = ((QuyenNhanVien)cbChucVu.SelectedItem).Quyen;
            float    mUCLUONG  = float.Parse(txbMucLuong.Text);
            string   mATKhau   = StaticClass.hasPass("1");

            if (string.IsNullOrEmpty(mANV))
            {
                fMessageBoxOK.Show("Chưa nhập mã nhân viên!");
                return;
            }
            if (NhanVienDAO.Instance.getAccountByUserName(mANV).Count > 0)
            {
                fMessageBoxOK.Show("Mã nhân viên đã tồn tại!");
                return;
            }
            if (!NhanVienDAO.Instance.insertNhanVien(mANV, hOTEN, nGAYSINH, diaChi, sDT, nGVAOLAM, pHANQUYEN, mUCLUONG, mATKhau))
            {
                fMessageBoxOK.Show("Xãy ra lỗi!");
            }
            NhanVienSource.DataSource = NhanVienDAO.Instance.getListNhanVien();
        }
    // Start is called before the first frame update
    void Start()
    {
        // Get the parameters past by the main menu
        terrainOffset = StaticClass.getTerrainOffset();
        // add new mesh object to the mesh filter and mesh collider defined on the empty game object
        mesh = new Mesh();
        // set index format to 32 bit -> more than 65K vertices could be rendered
        mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
        // get some components of the game object to perform different actions with them afterwards
        GetComponent <MeshFilter>().mesh = mesh;
        mc            = GetComponent <MeshCollider>();
        mc.sharedMesh = mesh;
        ps            = GetComponent <ParticleSystem>();
        rend          = GetComponent <Renderer>();

        //start routines for detecting single and double clicks
        StartCoroutine(InputListener());

        // call inital method for terrain generation with the diamond square algorithm
        CreateShape();

        this.varMainCamera = GameObject.FindWithTag("MainCamera");
        this.varTerrain    = GameObject.FindWithTag("TerrainAreaTag");

        //save position and rotation at start
        startCameraPosition = this.varMainCamera.transform.position;
        startView_Rot       = this.varMainCamera.transform.rotation;
    }
        /// <summary>
        /// thuc hien them loai mon an
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAccept_Click(object sender, EventArgs e)
        {
            string maloaima  = StaticClass.xoakhoangtrang(txbMALOAI.Text.ToUpper());
            string tenloaima = txbName.Text;

            if (string.IsNullOrEmpty(maloaima) || string.IsNullOrEmpty(tenloaima))
            {
                fMessageBoxOK.Show("Vui lòng điền đầy đủ thông tin!");
                return;
            }
            List <LoaiMonAnDTO> list = LoaiMonAnDAO.Instance.getListCategory();

            foreach (LoaiMonAnDTO item in list)
            {
                if (maloaima == item.MALOAIMA.ToUpper())
                {
                    fMessageBoxOK.Show("Loại món ăn đã tồn tại!");
                    return;
                }
            }
            if (!LoaiMonAnDAO.Instance.insertCategory(maloaima, tenloaima))
            {
                fMessageBoxOK.Show("Xảy ra sự cố khi thêm! vui lòng thực hiện lại");
                return;
            }
            fMessageBoxOK.Show("Thêm thành công.");
        }
        public VieModel_ImageViewer(string movieid)
        {
            DetailMovie models = DataBase.SelectDetailMovieById(movieid);

            //扫描目录
            List <string> imagePathList = new List <string>();

            try
            {
                foreach (var path in Directory.GetFiles(StaticVariable.BasePicPath + $"ExtraPic\\{models.id}\\"))
                {
                    imagePathList.Add(path);
                }
            }
            catch (Exception e) { Logger.LogE(e); }
            if (imagePathList.Count > 0)
            {
                imagePathList = imagePathList.CustomSort().ToList();
            }
            DetailMovie = new DetailMovie();
            if (models != null)
            {
                foreach (var path in imagePathList)
                {
                    models.extraimagelist.Add(StaticClass.GetExtraImage(path));                                //加载预览图
                }
                DetailMovie = models;
            }
        }
Beispiel #31
0
 private void SetStaticClass(Transaction trans, StaticClass sc)
 {
     // TODO: we should probably use a specific update depth here, 4?
     trans.Container().StoreInternal(trans, sc, true);
 }
Beispiel #32
0
 private void UpdateStaticClass(Transaction trans, StaticClass sc)
 {
     var stream = trans.Container();
     stream.Activate(trans, sc, new FixedActivationDepth(4));
     var existingFields = sc.fields;
     var staticFields = Iterators.Map(StaticReflectFields(), new _IFunction4_1760
         (this, existingFields, trans));
     sc.fields = ToStaticFieldArray(staticFields);
     if (!stream.IsClient)
     {
         SetStaticClass(trans, sc);
     }
 }
Beispiel #33
0
 private void CreateStaticClass(Transaction trans)
 {
     if (trans.Container().IsClient)
     {
         return;
     }
     var sc = new StaticClass(GetName(), ToStaticFieldArray(StaticReflectFieldsToStaticFields
         ()));
     SetStaticClass(trans, sc);
 }
Beispiel #34
0
        //private void IsolationTable_Scroll(object sender, EventArgs e) { IsolationTable.VerticalScroll.Value = (sender as ScrollBar).Value; }
        private void Main_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'nPLabDataSet.Engineers' table. You can move, or remove it, as needed.
            //this.engineersTableAdapter.Fill(this.nPLabDataSet.Engineers);
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<NPLabDbContext, Configuration>());

            currObj = (from p in db.Object
                       where p.Id == this.objId
                       select p).FirstOrDefault();
            //
            //var db = new NPLabDbContext();

            //Създаване на скролбар
            IsolationTable.AutoScroll = true;

            //Инициализация на статичните данни
            Stats = new StaticClass();

            //
            tempIsol = new EL_1
            {
                Date = DateTime.Now,
                SourceVoltage = System.Convert.ToInt32(Naprejenie.Value),
                Min = System.Convert.ToDouble(Norm.Value),
                MinMeasured = System.Convert.ToInt32(MinMeas.Value),
                MaxMeasured = System.Convert.ToInt32(MaxMeas.Value),
            };

            EngineerNameIsol.Items.AddRange(Stats.Engineers);
            EngineerNameIsol.SelectedIndex = 0;
            EngineerNameImp.Items.AddRange(Stats.Engineers);
            EngineerNameImp.SelectedIndex = 0;
            EngineerNameGr.Items.AddRange(Stats.Engineers);
            EngineerNameGr.SelectedIndex = 0;
            EngineerNameLiPro.Items.AddRange(Stats.Engineers);
            EngineerNameLiPro.SelectedIndex = 0;
            EngineerNameDef.Items.AddRange(Stats.Engineers);
            EngineerNameDef.SelectedIndex = 0;

            //Добавяне на вече съществуващите контроли към списъците с тях
            Names.Add(textBoxName);
            TypeCabs.Add(TypeCabel);
            Count.Add(Number);
            Surface.Add(CabelArea);
            MeasuredForm.Add(Measured);
            Conductors.Add(Cond);
            Rem.Add(Delete);

            //По подразбиране се избира тип кабел "СВТ"
            tempIsol.ListOfCabels.Add(new Cabel());
            TypeCabel.SelectedIndex = 0;
            textBoxName_TextChanged(textBoxName, new EventArgs());
            Number_ValueChanged(Number, new EventArgs());
            CabelArea_ValueChanged(CabelArea, new EventArgs());
            Measured_ValueChanged(Measured, new EventArgs());

            tempImp.Coefficent = System.Convert.ToInt32(Coefficient.Value);
            tempImp.MaxMeasured = System.Convert.ToDouble(Maximum.Value);
            tempImp.MinMeasured = System.Convert.ToDouble(Minimum.Value);

            Grounding gr = new Models.Grounding
            {
                AuxiliaryGrounding = System.Convert.ToDouble(AuxGr1.Value),
                Probe = System.Convert.ToDouble(Probe1.Value),
                Measured = System.Convert.ToDouble(Meas1.Value),
                Adjusted = System.Convert.ToDouble(Adj1.Value),
                Name = GroundingName.Text
            };
            tempGr.ListOfGroundings.Add(gr);

            LightningGrounding LiGr = new Models.LightningGrounding
            {
                AuxiliaryGrounding = System.Convert.ToDouble(AuxLi1.Value),
                Probe = System.Convert.ToDouble(ProbeLi1.Value),
                Measured = System.Convert.ToDouble(MeasLi1.Value),
                Adjusted = System.Convert.ToDouble(AdjLi1.Value),
                Name = LightningName.Text
            };
            tempLiPro.ListOfGroundings_El_3m.Add(LiGr);
            LoadObj(currObj);
            tempDef.DNHighest = System.Convert.ToDouble(MaxIN.Value);
            tempDef.DNLowest = System.Convert.ToDouble(MinIN.Value);
            tempDef.DTHighest = System.Convert.ToDouble(Maxt.Value);
            tempDef.DTLowest = System.Convert.ToDouble(Mint.Value);
            tempDef.maxDN = System.Convert.ToDouble(NormIN.Value);
            tempDef.maxDT = System.Convert.ToDouble(Normt.Value);
        }
Beispiel #35
0
 public static void Method (StaticClass arg)
 {
 }