// GET: WORKER/Edit/5
        public ActionResult Edit(int?id)
        {
            WORKER customer = new WORKER();

            customer = dao.Read(Convert.ToInt32(id));
            return(View(customer));
        }
Esempio n. 2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string email    = txtEmail.Text;
        string password = txtPassword.Text;

        CineKalyoncuDatabaseDataContext db = new CineKalyoncuDatabaseDataContext();

        CUSTOMER isCustomer = (from x in db.CUSTOMERs where x.Email == email && x.Password == password && x.Approve == true select x).SingleOrDefault();


        if (isCustomer != null)
        {
            Session["EnteredCustomer"] = isCustomer;
            Response.Redirect("CustomerHomePage.aspx");
        }

        WORKER isWorker = (from x in db.WORKERs where x.Email == email && x.Password == password && x.Approve == true select x).SingleOrDefault();

        if (isWorker != null)

        {
            Session["EnteredWorker"] = isWorker;
            Response.Redirect("WorkerHomepage.aspx");
        }
        else

        {
            lblMessage.Visible = true;
            lblMessage.Text    = "Please Check your Email or Password!";
        }
    }
Esempio n. 3
0
        public void Update(WORKER obj)
        {
            WORKER std = _DB.WORKERs.Find(obj.ID);

            std = obj;
            _DB.SaveChanges();
        }
Esempio n. 4
0
        // М-од сортировки сотрудников по стажу работы(по возрастанию)
        void SortWorkersByDate(WORKER[] element_worker, int N)
        {
            // Сортировка пузырьком
            WORKER[] tmp = new WORKER[1];

            for (int i = N - 1; i >= 0; i--)
            {
                for (int j = 0; j < i; j++)
                {
                    // Сравниваем элементы массива структур по стажу работы сотрудников
                    if (element_worker[j].Date > element_worker[j + 1].Date)
                    {
                        tmp[0].Surname  = element_worker[j].Surname;
                        tmp[0].Initials = element_worker[j].Initials;
                        tmp[0].Post     = element_worker[j].Post;
                        tmp[0].Date     = element_worker[j].Date;

                        element_worker[j].Surname  = element_worker[j + 1].Surname;
                        element_worker[j].Initials = element_worker[j + 1].Initials;
                        element_worker[j].Post     = element_worker[j + 1].Post;
                        element_worker[j].Date     = element_worker[j + 1].Date;

                        element_worker[j + 1].Surname  = tmp[0].Surname;
                        element_worker[j + 1].Initials = tmp[0].Initials;
                        element_worker[j + 1].Post     = tmp[0].Post;
                        element_worker[j + 1].Date     = tmp[0].Date;
                    }
                }
            }
        }
        // GET: WORKER/Delete/5
        public ActionResult Delete(int id)
        {
            WORKER customer = new WORKER();

            customer = dao.Read(id);
            return(View(customer));
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string login = textBox1.Text;
            WORKER q     = (from worker in DB.Workers
                            where worker.Login == login
                            select worker).FirstOrDefault <WORKER>();

            if (q != null)
            {
                MessageBox.Show("Пользователь с таким логином уже существует");
            }
            else
            {
                WORKER w = new WORKER()
                {
                    Login    = textBox1.Text,
                    Role     = checkBox1.Checked,
                    Password = textBox2.Text
                };
                DB.Workers.Add(w);
                DB.SaveChanges();
                MessageBox.Show("Вы зарегистрировали пользователя");
                Close();
            }
        }
Esempio n. 7
0
        public void Delete(int id)
        {
            WORKER obj = new WORKER();

            obj = _DB.WORKERs.Find(id);
            _DB.WORKERs.Remove(obj);
            _DB.SaveChanges();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            WORKER worker = db.WORKERs.Find(id);

            db.WORKERs.Remove(worker);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.TextLength > 0 && textBox2.TextLength > 0 && textBox3.TextLength > 0 && counter < 10)
     {
         list[counter] = new WORKER(textBox1.Text, textBox2.Text, textBox3.Text);
         listBox1.Items.Add(list[counter].NAME + " - " + list[counter].POST);
         counter++;
         textBox1.Text = textBox2.Text = textBox3.Text = "";
     }
 }
 public ActionResult Edit(WORKER worker)
 {
     if (ModelState.IsValid)
     {
         db.Entry(worker).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(worker));
 }
        //
        // GET: /WORKERs/Delete/5

        public ActionResult Delete(int id = 0)
        {
            WORKER worker = db.WORKERs.Find(id);

            if (worker == null)
            {
                return(HttpNotFound());
            }
            return(View(worker));
        }
        public ActionResult Create(WORKER worker)
        {
            if (ModelState.IsValid)
            {
                db.WORKERs.Add(worker);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(worker));
        }
 public ActionResult Create(WORKER customer)
 {
     try
     {
         dao.Create(customer);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Error", ex.Message);
     }
     return(RedirectToAction("Index"));
 }
Esempio n. 14
0
        private void button2_Click(object sender, EventArgs e) //Редактировать
        {
            var    login = dataGridView1.CurrentRow.Cells[0].Value;
            WORKER w     = (from worker in DB.Workers
                            where worker.Login == login
                            select worker).FirstOrDefault <WORKER>();
            Form10 addForm = new Form10();

            addForm.Workerq = w;
            addForm.DB      = this.DB;
            addForm.ShowDialog();
            dataGridView1.DataSource = DB.Workers.ToList();
        }
Esempio n. 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        WORKER newWorker = (WORKER)Session["EnteredWorker"];

        if (Session["MovieName"] != null && Session["Sesname"] != null && Session["Duration"] != null)
        {
            lblMessage.Visible = true;
            lblMessage.Text    = "The Movie Name " + Session["MovieName"] + " " + "and Session is " + " " + Session["Sesname"] + " " + "and Duration is " + " " + Session["Duration"] + " " + "Added by " + " " + newWorker.Name + " " + newWorker.Surname + " ";
        }
        if (Session["MOVIENAME"] != null && Session["SESSION"] != null && Session["PERSON"] != null && Session["ROOM"] != null && Session["CHAIR"] != null)
        {
            lblMessageSell.Visible = true;
            lblMessageSell.Text    = "The ticket selled which name is" + " " + Session["MOVIENAME"] + " the session " + Session["SESSION"] + "" + "the room is" + " " + Session["ROOM"] + " " + "the chair is" + "" + Session["CHAIR"] + "" + "for" + "" + Session["PERSON"] + " " + "person/s" + " " + "who name is" + "" + Session["USERNAME"] + " " + "and surname is " + " " + Session["USERSURNAME"] + " " + "by" + "" + newWorker.Name + " " + newWorker.Surname + " ";
        }
    }
Esempio n. 16
0
        private void BtnOpenClick(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter   = "String File|String.i3pack";
            dialog.FileName = "String.i3pack";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                tbxFile.Text     = dialog.FileName;
                tbxFile.Enabled  = true;
                lbxList.Enabled  = true;
                btnSave.Enabled  = true;
                btnApply.Enabled = true;
                _file            = dialog.FileName;
                lbxList.Items.Clear();
                //if (File.Exists(_file))
                //File.Copy(_file, string.Format("backup\\backup-{0:yyyy-MM-dd-HH-mm-ss}-String.i3Pack", DateTime.Now));
                WORKER.RunWorkerAsync();
            }
        }
Esempio n. 17
0
        private void BtnOpenClick(object sender, EventArgs e)
        {
            OpenFileDialog opDialog = new OpenFileDialog();

            opDialog.Filter = "Point Blank Pack file|*.i3Pack";
            if (opDialog.ShowDialog() == DialogResult.OK)
            {
                _packFile = opDialog.FileName;
                FileInfo packInfo = new FileInfo(_packFile);
                tbxFileName.Text = packInfo.Name;
                tbxFileName.Focus();
                lsView.Enabled   = false;
                lsView.ForeColor = SystemColors.ControlDarkDark;
                lbxList.Items.Clear();
                lbxList.Enabled = true;
                lsView.Items.Clear();
                trView.Nodes.Clear();
                trView.Enabled = false;

                _anu.Clear();
                _nodes.Clear();
                _breakPoint.Clear();
                _trn.Clear();
                _bodyPack.Clear();
                //_contentStarted = false;
                _QA = false;

                lblInfos.Visible = true;
                lblInfos.Text    = "Open i3Pack file to start.";
                pnlIfno.Enabled  = false;
                Info.Text        = "Info";

                btnUnpack.Enabled   = false;
                btnUnpack.BackColor = btnUnpack.Enabled ? SystemColors.Window : SystemColors.Control;
                btnRepack.Enabled   = false;
                btnRepack.BackColor = btnRepack.Enabled ? SystemColors.Window : SystemColors.Control;

                // Run Worker
                WORKER.RunWorkerAsync();
            }
        }
 public ActionResult Edit(int id, FormCollection formValues)
 {
     try
     {
         WORKER customer = new WORKER();
         customer            = dao.Read(id);
         customer.FIRST_NAME = Request.Form["FIRST_NAME"];
         customer.LAST_NAME  = Request.Form["LAST_NAME"];
         customer.WORKER_ID  = Convert.ToInt32(Request.Form["WORKER_ID"]);
         customer.EMAIL      = Request.Form["EMAIL"];
         customer.PHONE      = Request.Form["PHONE"];
         customer.USER_NAME  = Request.Form["USER_NAME"];
         customer.IS_ACTIVE  = Convert.ToBoolean(Request.Form["IS_ACTIVE"]);
         dao.Update(customer);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Error", ex.Message);
     }
     return(RedirectToAction("Index"));
 }
Esempio n. 19
0
 partial void DeleteWORKER(WORKER instance);
Esempio n. 20
0
        static void Main(string[] args)
        {
            WORKER w1  = new WORKER("Zavadskaya E.V.     ", "Student             ", 2018);
            WORKER w2  = new WORKER("Ivanov I.I.         ", "Designer            ", 2017);
            WORKER w3  = new WORKER("Tarasevich A.S.     ", "Student             ", 2016);
            WORKER w4  = new WORKER("Suchozkaja E.A.     ", "Student             ", 2016);
            WORKER w5  = new WORKER("Kruglic K.S.        ", "Student             ", 2016);
            WORKER w6  = new WORKER("Dementey A.A.       ", "Doctor              ", 2009);
            WORKER w7  = new WORKER("Racovski V.I.       ", "Cleaner             ", 2010);
            WORKER w8  = new WORKER("Gitsarev V.A.       ", "Programmer          ", 2014);
            WORKER w9  = new WORKER("Marchuc D.A.        ", "Teacher             ", 2015);
            WORKER w10 = new WORKER("Klitsunova K.S.     ", "Bartender           ", 2017);

            WORKER[] massiv = new WORKER[10] {
                w1, w2, w3, w4, w5, w6, w7, w8, w9, w10
            };
            using (Stream stream = new FileStream("worker.txt", FileMode.OpenOrCreate))
            {
                StreamWriter writer = new StreamWriter(stream, System.Text.Encoding.Default);
                for (int i = 0; i < 10; i++)
                {
                    writer.Write(massiv[i].name);
                    writer.Write(massiv[i].position);
                    writer.WriteLine(massiv[i].year);
                }

                writer.Flush();
                writer.Close();
            }

            for (int i = 0; i < massiv.Length; i++)
            {
                bool f = false;
                for (int j = 0; j < massiv.Length - 1; j++)
                {
                    if (massiv[j].year > massiv[j + 1].year)
                    {
                        f = true;
                        int temp = massiv[j].year;
                        massiv[j].year     = massiv[j + 1].year;
                        massiv[j + 1].year = temp;
                    }
                }
                if (!f)
                {
                    break;
                }
            }
            for (int i = 0; i < massiv.Length; i++)
            {
                Console.WriteLine(massiv[i].year);
            }
            using (Stream stream = new FileStream("worker1.txt", FileMode.OpenOrCreate))
            {
                StreamWriter writer = new StreamWriter(stream, System.Text.Encoding.Default);
                for (int i = 0; i < 10; i++)
                {
                    writer.Write(massiv[i].name);
                    writer.Write(massiv[i].position);
                    writer.WriteLine(massiv[i].year);
                }

                writer.Flush();
                writer.Close();
            }

            Console.WriteLine("Input the position: ");
            string position = Console.ReadLine();

            for (int i = 0; i < massiv.Length; i++)
            {
                if (massiv[i].position.Contains(position))
                {
                    Console.WriteLine(massiv[i].name);
                }
            }
        }
Esempio n. 21
0
        UUIRequest Load(string _name, bool _preloading, EOpenMode _openMode)
        {
            UUIWorker outWorker;

            //LOADING_AGAIN:
            if (TryGetWoker(_name, out outWorker))
            {
                //> 已经加载完毕了
                if (outWorker.State == EWorkerState.Loading || outWorker.State == EWorkerState.Working)
                {
                    return(outWorker.Request);
                }
                else
                {
                    //> 这段代码是不会发生的

                    /*if (null == outWorker.Script)
                     * {
                     *  RemoveFromContainer(outWorker);
                     *  UnloadResourceByInfo(outWorker.Info);
                     *  goto LOADING_AGAIN;
                     * }*/

                    if (_preloading)
                    {
                        outWorker.SetRest();
                    }
                    else
                    {
                        WorkLine.Add(outWorker);
                        if (WorkLine.Count > 1)
                        {
                            WorkLine[WorkLine.Count - 2].SetDownward();
                        }
                        outWorker.SetOpen();
                        outWorker.SetUpward();
                    }
                    return(outWorker.Request);
                }
            }
            else
            {
                UUIInfo outUIInfo;
                if (Manager.TryGetUIInfo(_name, out outUIInfo) == false)
                {
                    Output.Error("没有找到 {0} 的信息,加载UI失败!", _name);
                    return(null);
                }

                var worker = LoadUI(outUIInfo, _preloading ? EWorkerState.Resting : EWorkerState.Working, (WORKER, TEMPLATE) =>
                {
                    //> 加载完成,但是资源不存在
                    if (TEMPLATE == null)
                    {
                        RemoveFromContainer(WORKER);
                        UnloadResourceByInfo(WORKER.Info);
                        Output.Error("UI对象为空:{0}", outUIInfo.GetName());
                        return;
                    }

                    //> 在加载期间调用了Dispose
                    if (Container.Contains(WORKER) == false)
                    {
                        if (false == WORKER.Info.IsSceneObject)
                        {
                            GameObject.Destroy(TEMPLATE);
                        }
                        UnloadResourceByInfo(WORKER.Info);
                        Output.Warning("不存在的容器实例:{0}", WORKER.Info.GetName());
                        return;
                    }

                    if (false == WORKER.Info.IsSceneObject)
                    {
                        GameObject.DontDestroyOnLoad(TEMPLATE);
                    }

                    //> 对象身上没有挂在UUI脚本
                    if (false == WORKER.SetLoaded(Manager, TEMPLATE))
                    {
                        Output.Error("在UI对象{0}身上没有发现UUI脚本对象", _name);
                        UnloadWorker(WORKER, TEMPLATE);
                        return;
                    }

                    WORKER.Request.InitScript(TEMPLATE.GetComponent <UUIView>());

                    //> 处理下一个环节的工作
                    if (WORKER.NextState == EWorkerState.Working)
                    {
                        WORKER.SetOpen();
                        if (WorkLine[WorkLine.Count - 1] != WORKER)
                        {
                            WORKER.SetDownward();
                        }
                        else
                        {
                            WORKER.SetUpward();
                        }
                    }

                    //> 加载期间被设置了退出
                    else if (WORKER.NextState == EWorkerState.Exiting)
                    {
                        WORKER.SetClose(WORKER.NextExitState);
                    }
                });

                if (_preloading == false && WorkLine.Count > 1)
                {
                    WorkLine[WorkLine.Count - 2].SetDownward();
                }

                //> 根据工作模式,清理工作队列
                if (_preloading == false && _openMode == EOpenMode.Single)
                {
                    int idx = WorkLine.FindIndex((v) => worker == v);

                    if (idx > 0)
                    {
                        List <UUIWorker> temp = new List <UUIWorker>();
                        for (int i = 0; i < idx; i++)
                        {
                            temp.Insert(0, WorkLine[i]);
                        }
                        WorkLine.RemoveRange(0, idx);

                        //> 处理需要下岗的工人
                        foreach (var v in temp)
                        {
                            v.SetClose(false);
                        }
                        temp.Clear();
                    }
                }
                return(worker?.Request);
            }
        }
Esempio n. 22
0
 public void Create(WORKER obj)
 {
     _DB.WORKERs.Add(obj);
     _DB.SaveChanges();
 }
        // GET: WORKER/Create
        public ActionResult Create()
        {
            WORKER customer = new WORKER();

            return(View(customer));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        WORKER newWorker = (WORKER)Session["EnteredWorker"];

        LblWelcome.Text = "Welcome " + newWorker.Name + " " + newWorker.Surname;
    }
Esempio n. 25
0
 partial void UpdateWORKER(WORKER instance);
Esempio n. 26
0
        private void b_Revers_Click(object sender, EventArgs e)
        {
            // Создаём новую структуру для переворачивания
            WORKER[] new_worker = new WORKER[lB_workers.Items.Count];

            if (!search_enabled)
            {
                // Кидаем инфу новой структуре о данных старой структуры
                for (int i = 0; i < lB_workers.Items.Count; i++)
                {
                    new_worker[i].Surname  = worker[i].Surname;
                    new_worker[i].Initials = worker[i].Initials;
                    new_worker[i].Post     = worker[i].Post;
                    new_worker[i].Date     = worker[i].Date;
                }

                // Переворачиваем новую структуру
                Array.Reverse(new_worker);

                // Отдаём "перевернутую" инфу старой структуре
                for (int i = 0; i < lB_workers.Items.Count; i++)
                {
                    worker[i].Surname  = new_worker[i].Surname;
                    worker[i].Initials = new_worker[i].Initials;
                    worker[i].Post     = new_worker[i].Post;
                    worker[i].Date     = new_worker[i].Date;
                }

                ClearInfo();

                // Получаем кол-во сотрудников в списке
                int length = 0; // счётчик

                while (worker[length].Date != 0)
                {
                    length++;
                }

                // Добавляем "перевёрнутую" структуру в листбокс
                for (int i = 0; i < length; i++)
                {
                    lB_workers.Items.Add(worker[i].Surname + " " + worker[i].Initials);
                }
            }
            else
            {
                // Кидаем инфу новой структуре о данных search структуры
                for (int i = 0; i < lB_workers.Items.Count; i++)
                {
                    new_worker[i].Surname  = search_worker[i].Surname;
                    new_worker[i].Initials = search_worker[i].Initials;
                    new_worker[i].Post     = search_worker[i].Post;
                    new_worker[i].Date     = search_worker[i].Date;
                }

                // Переворачиваем новую структуру
                Array.Reverse(new_worker);

                // Отдаём "перевернутую" инфу search структуре
                for (int i = 0; i < lB_workers.Items.Count; i++)
                {
                    search_worker[i].Surname  = new_worker[i].Surname;
                    search_worker[i].Initials = new_worker[i].Initials;
                    search_worker[i].Post     = new_worker[i].Post;
                    search_worker[i].Date     = new_worker[i].Date;
                }

                // Очищаем панельки от инфы
                ClearInfo();

                // Получаем кол-во сотрудников в списке
                int length = 0; // счётчик

                while (search_worker[length].Date != 0)
                {
                    length++;
                }

                // Добавляем "перевёрнутую" структуру в листбокс
                for (int i = 0; i < length; i++)
                {
                    lB_workers.Items.Add(search_worker[i].Surname + " " + search_worker[i].Initials);
                }
            }
        }
Esempio n. 27
0
 public Form10()
 {
     InitializeComponent();
     Workerq = null;
 }
Esempio n. 28
0
 partial void InsertWORKER(WORKER instance);