Пример #1
0
        internal string GetHardwareCode(int p)
        {
            Equipment_Data obj = new Equipment_Data();

            Hardware = p;
            return(obj.GetHardwareCode(p));
        }
Пример #2
0
        internal bool Search(string type, string value)
        {
            Equipment_Data myEquipment = new Equipment_Data();

            try
            {
                if (type == "")
                {
                    throw new HardWareExeption("نوع سرچ را انتخاب کنید");
                }
                else if (value == "")
                {
                    throw new HardWareExeption("مقدار را وارد کنید");
                }
                else
                {
                    SearchEquipment = myEquipment.Search(type, value);
                    this._message   = "";
                    return(true);
                }
            }
            catch (HardWareExeption ex)
            {
                this._message = ex.Message;
                return(false);
            }
            catch (Exception ex)
            {
                this._message = ex.Message;
                return(false);
            }
        }
Пример #3
0
        internal int GetPersonCode(int p)
        {
            Equipment_Data obj = new Equipment_Data();

            PersonCode = p;
            return(obj.GetPersonCode(p));
        }
Пример #4
0
        internal string GetStateCode(int p)
        {
            Equipment_Data obj = new Equipment_Data();

            State = p;
            return(obj.GetStateCode(p));
        }
Пример #5
0
        protected void GrDelete(object sender, CommandEventArgs e)
        {
            int nPageNumber             = int.Parse(txtPageNumber.Text);
            int nPageSize               = int.Parse(txtPageSize.Text);
            SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"];

            nUserLogin.CheckRole("CA0006");
            if (!nUserLogin.Role.Del)
            {
                Response.Write("<script >alert('Bạn không có quyền xóa danh mục này!')</script>");
            }
            else
            {
                try
                {
                    int            mKey = int.Parse(e.CommandArgument.ToString());
                    Equipment_Info info = new Equipment_Info(mKey);
                    info.Delete();
                    DataTable nTable = Equipment_Data.GetList(nPageSize, nPageNumber, txtSearch.Text);
                    GV_Equipment.DataSource = nTable;
                    GV_Equipment.DataBind();
                    LoadPages();
                }
                catch
                {
                    Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
                }
            }
        }
Пример #6
0
        internal IEnumerable <Equipment_Data> SelectAllEquipmentOfPerson(string perCode)
        {
            Equipment_Data e = new Equipment_Data();

            PersonCode = Convert.ToInt32(perCode);
            return(e.SelectAllEquipmentOfPerson(PersonCode));
        }
Пример #7
0
 public bool Add(int hardware, string model, string warranty, string warBegin, string warEnd, int state, int person)
 {
     try
     {
         Model      = model;
         Warranty   = warranty;
         WarBegin   = warBegin;
         WarEnd     = warEnd;
         State      = state;
         Hardware   = hardware;
         PersonCode = person;
         Equipment_Data obj = new Equipment_Data(hardware, model, warranty, warBegin, warEnd, state, person);
         this._message = null;
         return(true);
     }
     catch (HardWareExeption ex)
     {
         this._message = ex.Message;
         return(false);
     }
     catch (Exception ex)
     {
         this._message = ex.Message;
         return(false);
     }
 }
Пример #8
0
        private void EqupButton_Click(object sender, RoutedEventArgs e)
        {
            Equipment_Data EqD = new Equipment_Data();

            string SelItemMun = (((ComboBoxItem)(MunCombo.SelectedItem)).Content).ToString();
            int    SelMunID   = 0;
            string SelItemMod = (((ComboBoxItem)(ModCombo.SelectedItem)).Content).ToString();
            int    SelModID   = 0;
            string SelItemAdr = (((ComboBoxItem)(AdrCombo.SelectedItem)).Content).ToString();
            int    SelAdrID   = 0;

            List <Equipment_Base> Eq_Data = EqD.GetData();

            foreach (var item in Eq_Data)
            {
                if (item.ManufacturerName.ToString() == SelItemMun)
                {
                    SelMunID = item.intManufacturerID;
                }
                if (item.ModelName.ToString() == SelItemMod)
                {
                    SelModID = item.intModelID;
                }
                if (item.strLocationName.ToString() == SelItemAdr)
                {
                    SelAdrID = item.intLocationId;
                }
            }
            EqD.Set_Data(ManID: SelMunID, ModID: SelModID, locID: SelAdrID);
            EquipStack.Children.Clear();
            Initial_Equipment();
        }
Пример #9
0
        /**********************************/

        /*************سازنده *************/

        //public Equipment(int hardware, string model, string warranty, string warBegin, string warEnd, int state, int personCode)
        //{
        //    if(Add(hardware,model,warranty,warBegin,warEnd,state,personCode))

        //}
        public Equipment(int code)
        {
            try
            {
                Code = code;
                Equipment_Data equipment = new Equipment_Data();
                if (!this.Freezed(code))
                {
                    var e = equipment.SelectEquipment(code);
                    var w = equipment.SelectWarranty(Convert.ToInt32(e.warranty_code));
                    var s = equipment.SelectState(Convert.ToInt32(e.state_code));
                    var h = equipment.SelectHardware(Convert.ToInt32(e.hardware_code));

                    Model    = e.equipment_model;
                    Warranty = w.warranty_name;
                    WarBegin = w.warranty_start;
                    WarEnd   = w.warranty_end;
                    State    = s.state_code;
                    Hardware = h.hardware_code;
                }
            }
            catch (HardWareExeption ex)
            {
                this._message = ex.Message;
                return;
            }
            catch (Exception ex)
            {
                this._message = ex.Message;
                return;
            }
        }
Пример #10
0
        private void MunCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Equipment_Data EqD = new Equipment_Data();

            string SelItemMun = (((ComboBoxItem)(MunCombo.SelectedItem)).Content).ToString();
            int    SelModID   = 0;

            List <Equipment_Base> Eq_Data = EqD.GetData();

            foreach (var item in Eq_Data)
            {
                if (item.ManufacturerName.ToString() == SelItemMun)
                {
                    SelModID = item.intModelID;
                }
            }

            try
            {
                Model_Data modDB    = new Model_Data();
                int        i        = 0;
                int        NumOfRow = modDB.Model_Table.Count;

                ComboBoxItem[] itemsMod = new ComboBoxItem[NumOfRow];
                ModCombo.Items.Clear();

                bool first = true;
                bool teg   = false;
                foreach (var item in modDB.Model_Table)
                {
                    if (SelModID == item.intModelID)
                    {
                        teg         = true;
                        itemsMod[i] = new ComboBoxItem
                        {
                            Content    = item.strName,
                            IsSelected = first
                        };
                        ModCombo.Items.Add(itemsMod[i]);
                        i++;
                    }
                }
                if (teg == false)
                {
                    itemsMod[i] = new ComboBoxItem
                    {
                        Content = "Нет моделей"
                    };
                    ModCombo.Items.Add(itemsMod[i]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #11
0
        private void LoadData()
        {
            int       nPageNumber = int.Parse(txtPageNumber.Text);
            int       nPageSize   = int.Parse(txtPageSize.Text);
            DataTable nTable      = Equipment_Data.GetList(nPageSize, nPageNumber, txtSearch.Text);

            GV_Equipment.DataSource = nTable;
            GV_Equipment.DataBind();
            LoadPages();
        }
Пример #12
0
        protected void cmdView_Click1(object sender, ImageClickEventArgs e)
        {
            txtPageNumber.Text = "1";
            int       nPageNumber = int.Parse(txtPageNumber.Text);
            int       nPageSize   = int.Parse(txtPageSize.Text);
            DataTable nTable      = Equipment_Data.GetList(nPageSize, 1, txtSearch.Text);

            GV_Equipment.DataSource = nTable;
            GV_Equipment.DataBind();
            LoadPages();
        }
Пример #13
0
        /*********************************/

        /*************متدهای کلاس *************/
        private bool Freezed(int code)
        {
            Equipment_Data e = new Equipment_Data();

            if (e.Freezed_Data(code))
            {
                throw new HardWareExeption("این قطعه در حالت فریز می باشد");
            }
            else
            {
                return(false);
            }
        }
Пример #14
0
        internal bool Update(int code, int hardware, string model, string warranty, string warBegin, string warEnd, int state)
        {
            Equipment_Data myEquipment = new Equipment_Data();

            try
            {
                Code     = code;
                Model    = model;
                Warranty = warranty;
                WarBegin = warBegin;
                WarEnd   = warEnd;
                State    = state;
                Hardware = hardware;

                if (!myEquipment.Freezed_Data(Code))
                {
                    if (myEquipment.CheckCode(Code))
                    {
                        if (myEquipment.CheckCodeHardWare(Hardware))
                        {
                            if (myEquipment.CheckCodeState(State))
                            {
                                myEquipment.Update(Code, Hardware, Model, Warranty, WarBegin, WarEnd, State);
                                this._message = null;
                            }
                        }
                    }
                }

                return(true);
            }
            catch (HardWareExeption ex)
            {
                this._message = ex.Message;
                return(false);
            }
            catch (Exception ex)
            {
                this._message = ex.Message;
                return(false);
            }
        }
Пример #15
0
        protected void LoadPages()
        {
            int nPageNumber = int.Parse(txtPageNumber.Text);
            int nPageSize   = int.Parse(txtPageSize.Text);

            int nTotalRecord = Equipment_Data.Count(txtSearch.Text);

            if (nTotalRecord > nPageSize)
            {
                PageNumbers.Visible = true;
                DataTable nTable = TNLibrary.WEB.LoadDataToToolboxWeb.LoadPageSize(nPageSize, nTotalRecord, nPageNumber);

                PageNumbers.SelectedIndex = (nPageNumber - 1) - (int.Parse(nTable.Rows[0][0].ToString()) - 1);
                PageNumbers.DataSource    = nTable;
                PageNumbers.DataBind();
            }
            else
            {
                PageNumbers.Visible = false;
            }
        }
Пример #16
0
        /*************************************/

        internal bool ChangeStatus(int equipment, string person, string tozih)
        {
            Equipment_Data e = new Equipment_Data();

            try
            {
                Code       = equipment;
                PersonCode = Convert.ToInt32(person);
                e.ChangeStatus(Code, PersonCode, tozih);
                return(true);
            }
            catch (HardWareExeption ex)
            {
                this._message = ex.Message;
                return(false);
            }
            catch (Exception ex)
            {
                this._message = ex.Message;
                return(false);
            }
        }
Пример #17
0
        internal bool Freezing(int code)
        {
            Equipment_Data e = new Equipment_Data();

            try
            {
                if (!this.Freezed(code))
                {
                    e.Freezing_Data(code);
                    return(true);
                }
            }
            catch (HardWareExeption ex)
            {
                this._message = ex.Message;
                return(false);
            }
            catch (Exception ex)
            {
                this._message = ex.Message;
                return(false);
            }
            return(false);
        }
Пример #18
0
        internal int GetLastCode()
        {
            Equipment_Data obj = new Equipment_Data();

            return(obj.Code);
        }
Пример #19
0
        internal IEnumerable <Equipment_Data> SelectAllHardwares()
        {
            Equipment_Data e = new Equipment_Data();

            return(e.SelectAllHardwares());
        }
Пример #20
0
        internal IEnumerable <Equipment_Data> SelectAllPersons()
        {
            Equipment_Data e = new Equipment_Data();

            return(e.SelectAllPersons());
        }
Пример #21
0
        public void Initial_Equipment()
        {
            try
            {
                Equipment_Data EqDB     = new Equipment_Data();
                int            i        = 0;
                int            NumOfRow = EqDB.Equipment_Table.Count;

                Grid[]  grids    = new Grid[NumOfRow];
                Label[] lableMun = new Label[NumOfRow];
                Label[] lableMod = new Label[NumOfRow];
                Label[] lableAdr = new Label[NumOfRow];
                Label[] lableID  = new Label[NumOfRow];

                foreach (var item in EqDB.Equipment_Table)
                {
                    lableID[i] = new Label
                    {
                        Content         = item.intEquipmentID,
                        BorderBrush     = Brushes.Black,
                        BorderThickness = new Thickness(0.0, 0.0, 0.0, 1.0),
                    };

                    lableMun[i] = new Label
                    {
                        Content         = item.ManufacturerName,
                        BorderBrush     = Brushes.Black,
                        BorderThickness = new Thickness(1.0, 0.0, 0.0, 1.0)
                    };

                    lableMod[i] = new Label
                    {
                        Content         = item.ModelName,
                        BorderBrush     = Brushes.Black,
                        BorderThickness = new Thickness(1.0, 0.0, 0.0, 1.0)
                    };

                    lableAdr[i] = new Label
                    {
                        Content         = item.strLocationName,
                        BorderBrush     = Brushes.Black,
                        BorderThickness = new Thickness(1.0, 0.0, 1.0, 1.0)
                    };

                    grids[i] = new Grid {
                    };
                    grids[i].ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(40)
                    });
                    grids[i].ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1.0, GridUnitType.Star)
                    });
                    grids[i].ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1.0, GridUnitType.Star)
                    });
                    grids[i].ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1.0, GridUnitType.Star)
                    });

                    grids[i].Children.Add(lableID[i]);
                    grids[i].Children.Add(lableMun[i]);
                    grids[i].Children.Add(lableMod[i]);
                    grids[i].Children.Add(lableAdr[i]);

                    Grid.SetColumn(lableID[i], 0);
                    Grid.SetColumn(lableMun[i], 1);
                    Grid.SetColumn(lableMod[i], 2);
                    Grid.SetColumn(lableAdr[i], 3);

                    EquipStack.Children.Add(grids[i]);
                    i++;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #22
0
        public string SelectAllEquipmentOfDate(int code, string date)
        {
            Equipment_Data e = new Equipment_Data();

            return(e.SelectAllEquipmentOfDate(code, date));
        }