示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                
                _lock = false;
                UserLookAndFeel.Default.SkinName = Settings.Default.ApplicationSkinName;
                var ktBatch = (from w in Global.Db.tbl_Batches where w.fBatchName == Global.StrBatch select w.ChiaUser).FirstOrDefault();
                if (ktBatch==true)
                {
                    Global.BatchChiaUser = true;
                }
                else
                {
                    Global.BatchChiaUser = false;
                }
                lb_IdImage.Text = "";
                lb_fBatchName.Text = Global.StrBatch;
                lb_UserName.Text = Global.StrUsername;
                lb_TongSoHinh.Text = (from w in Global.Db.tbl_Images where w.fbatchname == Global.StrBatch select w.idimage).Count().ToString();
                lb_SoHinhConLai.Text = (from w in Global.Db.tbl_Images where w.ReadImageDESo < 2 && w.fbatchname == Global.StrBatch && (w.UserNameDESo != Global.StrUsername || w.UserNameDESo == null || w.UserNameDESo == "") select w.idimage).Count().ToString();
                lb_SoHinhLamDuoc.Text = (from w in Global.Db.tbl_MissImage_DESOs where w.UserName == Global.StrUsername && w.fBatchName == Global.StrBatch select w.IdImage).Count().ToString();

                bar_Manager.Enabled = false;
                btn_Stop_Performance_Test.Enabled = false;
                bar_Manager.Enabled = false;
                if (Global.StrRole == "DESO" || Global.StrRole == "DEJP")
                {
                    Global.FlagTong = true;
                    bar_Manager.Enabled = false;
                    btn_Submit_Logout.Enabled = false;
                    btn_ZoomImage.Enabled = false;
                    btn_Check.Enabled = false;
                    UcNatsu1.ResetData();
                }
                else if (Global.StrRole == "ADMIN")
                {
                    Global.FlagTong = false;
                    btn_Start_Submit.Enabled = false;
                    btn_Submit_Logout.Enabled = false;
                    btn_ZoomImage.Enabled = true;
                    bar_Manager.Enabled = true;
                    btn_Check.Enabled = true;
                }
                else if (Global.StrRole == "CHECKERDESO" || Global.StrRole == "CHECKERDEJP" || Global.StrRole == "CHECKERDECHU")
                {
                    Global.FlagTong = false;
                    btn_Start_Submit.Enabled = false;
                    btn_Submit_Logout.Enabled = false;
                    btn_ZoomImage.Enabled = true;
                    bar_Manager.Enabled = false;
                    btn_Check.Enabled = true;
                }
                SetValue();
            }
            catch (Exception i)
            {
                MessageBox.Show(@"Error Load Main: " + i.Message);
            }
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                lb_IdImage.Text       = "";
                lb_fBatchName.Text    = Global.StrBatch;
                lb_UserName.Text      = Global.StrUsername;
                lb_TongSoHinh.Text    = (from w in Global.Db.tbl_Images where w.fbatchname == Global.StrBatch select w.idimage).Count().ToString();
                lb_SoHinhConLai.Text  = (from w in Global.Db.tbl_Images where w.ReadImageDESo < 2 && w.fbatchname == Global.StrBatch && (w.UserNameDESo != Global.StrUsername || w.UserNameDESo == null || w.UserNameDESo == "") select w.idimage).Count().ToString();
                lb_SoHinhLamDuoc.Text = (from w in Global.Db.tbl_MissImage_DESOs where w.UserName == Global.StrUsername && w.fBatchName == Global.StrBatch select w.IdImage).Count().ToString();

                bar_Manager.Enabled = false;
                if (Global.StrRole == "DESO")
                {
                    UcNatsu1.ResetData();
                }
                else
                {
                    btn_Start_Submit.Enabled  = false;
                    btn_Submit_Logout.Enabled = false;
                    bar_Manager.Enabled       = true;
                }
                SetValue();
            }
            catch (Exception i)
            {
                MessageBox.Show(@"Error Load Main: " + i.Message);
            }
        }
示例#3
0
        private void btn_Submit_Logout_Click(object sender, EventArgs e)
        {
            try
            {
                Global.DbBpo.UpdateTimeLastRequest(Global.StrToken);
                //Kiểm tra token
                var token = (from w in Global.DbBpo.tbl_TokenLogins where w.UserName == Global.StrUsername && w.IDProject == Global.StrIdProject select w.Token).FirstOrDefault();

                if (token != Global.StrToken)
                {
                    MessageBox.Show(@"User logged on to another PC, please login again!");
                    DialogResult = DialogResult.Yes;
                }
                if (Global.StrRole == "DESO")
                {
                    if (UcNatsu1.IsEmpty())
                    {
                        if (MessageBox.Show(@"A field(s) is empty. Do you want to continue ? \r\nYes = Submit and next Image < Press Enter >\r\nNo = Enter the blank field for this image. < Press N > ", @"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            return;
                        }
                    }
                    UcNatsu1.SaveData(lb_IdImage.Text);
                }
                btn_Logout_ItemClick(null, null);
            }
            catch (Exception i)
            {
                MessageBox.Show(@"Error Submit" + i.Message);
            }
        }
示例#4
0
        private void btn_Start_Submit_Click(object sender, EventArgs e)
        {
            try
            {
                
                Global.DbBpo.UpdateTimeLastRequest(Global.StrToken);
                //Kiểm tra token
                var token = (from w in Global.DbBpo.tbl_TokenLogins where w.UserName == Global.StrUsername && w.IDProject == Global.StrIdProject select w.Token).FirstOrDefault();

                if (token != Global.StrToken)
                {
                    MessageBox.Show(@"User logged on to another PC, please login again!");
                    DialogResult = DialogResult.Yes;
                }
                if (btn_Start_Submit.Text == @"Start")
                {
                    
                    if (string.IsNullOrEmpty(Global.StrBatch))
                    {
                        MessageBox.Show(@"Please log in again and select Batch!");
                        return;
                    }
                    var ktBatch1 = (from w in Global.Db.tbl_Batches where w.fBatchName == Global.StrBatch select w.ChiaUser).FirstOrDefault();
                    if (ktBatch1 == true)
                    {
                        Global.BatchChiaUser = true;
                    }
                    else
                    {
                        Global.BatchChiaUser = false;
                    }
                    string temp = GetImage();
                    if (temp == "NULL")
                    {
                        if (Global.NotGoodUser)
                        {
                            var listResult = Global.Db.GetBatNotFinishDeSo_NotGood_New1(Global.StrUsername).ToList();
                            if (listResult.Count > 0)
                            {
                                if (MessageBox.Show(@"Batch next is: " + listResult[0].fbatchname + "\nWould you like to continue??", "Notification!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                {
                                    Global.StrBatch = listResult[0].fbatchname;
                                    var ktBatch = (from w in Global.Db.tbl_Batches where w.fBatchName == Global.StrBatch select w.ChiaUser).FirstOrDefault();
                                    if (ktBatch == true)
                                    {
                                        Global.BatchChiaUser = true;
                                    }
                                    else
                                    {
                                        Global.BatchChiaUser = false;
                                    }
                                    lb_fBatchName.Text = Global.StrBatch;
                                    lb_IdImage.Text = "";
                                    lb_TongSoHinh.Text =
                                        (from w in Global.Db.tbl_Images where w.fbatchname == Global.StrBatch select w.idimage).Count().ToString();
                                    lb_SoHinhConLai.Text = (from w in Global.Db.tbl_Images where w.ReadImageDESo < 2 && w.fbatchname == Global.StrBatch && (w.UserNameDESo != Global.StrUsername || w.UserNameDESo == null || w.UserNameDESo == "") select w.idimage).Count().ToString();
                                    lb_SoHinhLamDuoc.Text = (from w in Global.Db.tbl_MissImage_DESOs where w.UserName == Global.StrUsername && w.fBatchName == Global.StrBatch select w.IdImage).Count().ToString();

                                    SetValue();
                                    btn_Start_Submit.Text = @"Start";
                                    btn_Start_Submit_Click(null, null);
                                }
                                else
                                {
                                    btn_Logout_ItemClick(null, null);
                                }
                            }
                            else
                            {
                                MessageBox.Show(@"Finished batch '" + lb_fBatchName.Text + "'");
                                btn_Logout_ItemClick(null, null);
                            }

                        }
                        else
                        {
                            var listResult = Global.Db.GetBatNotFinishDeSo_Good_New1(Global.StrUsername).ToList();
                            if (listResult.Count > 0)
                            {
                                if (MessageBox.Show(@"Batch next is: " + listResult[0].fbatchname + "\nWould you like to continue??", "Notification!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                {
                                    Global.StrBatch = listResult[0].fbatchname;
                                    var ktBatch = (from w in Global.Db.tbl_Batches where w.fBatchName == Global.StrBatch select w.ChiaUser).FirstOrDefault();
                                    if (ktBatch == true)
                                    {
                                        Global.BatchChiaUser = true;
                                    }
                                    else
                                    {
                                        Global.BatchChiaUser = false;
                                    }
                                    lb_fBatchName.Text = Global.StrBatch;
                                    lb_IdImage.Text = "";
                                    lb_TongSoHinh.Text =
                                        (from w in Global.Db.tbl_Images where w.fbatchname == Global.StrBatch select w.idimage).Count().ToString();
                                    lb_SoHinhConLai.Text = (from w in Global.Db.tbl_Images where w.ReadImageDESo < 2 && w.fbatchname == Global.StrBatch && (w.UserNameDESo != Global.StrUsername || w.UserNameDESo == null || w.UserNameDESo == "") select w.idimage).Count().ToString();
                                    lb_SoHinhLamDuoc.Text = (from w in Global.Db.tbl_MissImage_DESOs where w.UserName == Global.StrUsername && w.fBatchName == Global.StrBatch select w.IdImage).Count().ToString();

                                    SetValue();
                                    btn_Start_Submit.Text = @"Start";
                                    btn_Start_Submit_Click(null, null);
                                }
                                else
                                {
                                    btn_Logout_ItemClick(null, null);
                                }
                            }
                            else
                            {
                                MessageBox.Show(@"Finished batch '" + lb_fBatchName.Text + "'");
                                btn_Logout_ItemClick(null, null);
                            }

                        }
                    }
                    else if (temp == "Error")
                    {
                        MessageBox.Show(@"Can not load image!");
                        btn_Logout_ItemClick(null, null);
                    }
                    UcNatsu1.ResetData();
                    btn_Start_Submit.Text = @"Submit";

                }
                else
                {
                    if (Global.StrRole == "DESO")
                    {
                        if (UcNatsu1.TrongTruongSo3())
                        {
                            MessageBox.Show(@"Vui lòng kiểm tra lại trường số 3");
                            return;
                        }
                        if (UcNatsu1.IsEmptyTruong00(UcNatsu1.UcNatsuItem1) || UcNatsu1.IsEmptyTruong00(UcNatsu1.UcNatsuItem2) || UcNatsu1.IsEmptyTruong00(UcNatsu1.UcNatsuItem3) || UcNatsu1.IsEmptyTruong00(UcNatsu1.UcNatsuItem4) || UcNatsu1.IsEmptyTruong00(UcNatsu1.UcNatsuItem5))
                        {
                            MessageBox.Show(@"Field 00 is empty");
                            return;
                        }
                        if (UcNatsu1.TrongTruongSo12())
                        {
                            MessageBox.Show(@"Vui lòng kiểm tra lại trường số 12");
                            return;
                        }
                        if (UcNatsu1.IsEmpty())
                        {
                            if (MessageBox.Show(@"A field(s) is empty. Do you want to continue ? \r\nYes = Submit and next Image < Press Enter >\r\nNo = Enter the blank field for this image. < Press N > ", @"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning,MessageBoxDefaultButton.Button2) == DialogResult.No)
                                return;
                        }
                        UcNatsu1.SaveData(lb_IdImage.Text);
                        UcNatsu1.ResetData();
                        var version = (from w in Global.DbBpo.tbl_Versions where w.IDProject == Global.StrIdProject select w.IDVersion).FirstOrDefault();
                        if (version!=Global.Version)
                        {
                            MessageBox.Show(@"The current version is out of date, please update to the new version!");
                            Process.Start(Global.UrlUpdateVersion);
                            Application.Exit();
                        }
                        string temp = GetImage();
                        if (temp == "NULL")
                        {
                            
                            if (Global.NotGoodUser)
                            {
                                var listResult = Global.Db.GetBatNotFinishDeSo_NotGood_New1(Global.StrUsername).ToList();
                                if (listResult.Count > 0)
                                {
                                    if (MessageBox.Show(@"Batch next is: " + listResult[0].fbatchname + "\nWould you like to continue??", @"Notification!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                    {
                                        Global.StrBatch = listResult[0].fbatchname;
                                        var ktBatch = (from w in Global.Db.tbl_Batches where w.fBatchName == Global.StrBatch select w.ChiaUser).FirstOrDefault();
                                        if (ktBatch == true)
                                        {
                                            Global.BatchChiaUser = true;
                                        }
                                        else
                                        {
                                            Global.BatchChiaUser = false;
                                        }
                                        lb_fBatchName.Text = Global.StrBatch;
                                        lb_IdImage.Text = "";
                                        lb_TongSoHinh.Text =
                                            (from w in Global.Db.tbl_Images where w.fbatchname == Global.StrBatch select w.idimage).Count().ToString();
                                        lb_SoHinhConLai.Text = (from w in Global.Db.tbl_Images where w.ReadImageDESo < 2 && w.fbatchname == Global.StrBatch && (w.UserNameDESo != Global.StrUsername || w.UserNameDESo == null || w.UserNameDESo == "") select w.idimage).Count().ToString();
                                        lb_SoHinhLamDuoc.Text = (from w in Global.Db.tbl_MissImage_DESOs where w.UserName == Global.StrUsername && w.fBatchName == Global.StrBatch select w.IdImage).Count().ToString();

                                        SetValue();
                                        btn_Start_Submit.Text = @"Start";
                                        btn_Submit_Logout.Enabled = false;
                                        btn_Start_Submit_Click(null, null);
                                    }
                                    else
                                    {
                                        btn_Logout_ItemClick(null, null);
                                    }
                                }
                                else
                                {
                                    MessageBox.Show(@"Finished batch '" + lb_fBatchName.Text + "'");
                                    btn_Logout_ItemClick(null, null);
                                }

                            }
                            else
                            {
                                var listResult = Global.Db.GetBatNotFinishDeSo_Good_New1(Global.StrUsername).ToList();
                                if (listResult.Count > 0)
                                {
                                    if (MessageBox.Show(@"Batch next is: " + listResult[0].fbatchname + "\nWould you like to continue??", @"Notification!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                    {
                                        Global.StrBatch = listResult[0].fbatchname;
                                        var ktBatch = (from w in Global.Db.tbl_Batches where w.fBatchName == Global.StrBatch select w.ChiaUser).FirstOrDefault();
                                        if (ktBatch == true)
                                        {
                                            Global.BatchChiaUser = true;
                                        }
                                        else
                                        {
                                            Global.BatchChiaUser = false;
                                        }
                                        lb_fBatchName.Text = Global.StrBatch;
                                        lb_IdImage.Text = "";
                                        lb_TongSoHinh.Text =
                                            (from w in Global.Db.tbl_Images where w.fbatchname == Global.StrBatch select w.idimage).Count().ToString();
                                        lb_SoHinhConLai.Text = (from w in Global.Db.tbl_Images where w.ReadImageDESo < 2 && w.fbatchname == Global.StrBatch && (w.UserNameDESo != Global.StrUsername || w.UserNameDESo == null || w.UserNameDESo == "") select w.idimage).Count().ToString();
                                        lb_SoHinhLamDuoc.Text = (from w in Global.Db.tbl_MissImage_DESOs where w.UserName == Global.StrUsername && w.fBatchName == Global.StrBatch select w.IdImage).Count().ToString();

                                        SetValue();
                                        btn_Start_Submit.Text = @"Start";
                                        btn_Submit_Logout.Enabled = false;
                                        btn_Start_Submit_Click(null, null);
                                    }
                                    else
                                    {
                                        btn_Logout_ItemClick(null, null);
                                    }
                                }
                                else
                                {
                                    MessageBox.Show(@"Finished batch '" + lb_fBatchName.Text + "'");
                                    btn_Logout_ItemClick(null, null);
                                }

                            }
                            
                        }
                        else if (temp == "Error")
                        {
                            MessageBox.Show(@"Can not load image!");
                            btn_Logout_ItemClick(null, null);
                        }
                    }
                    SetValue();
                }
            }
            catch (Exception i)
            {
                MessageBox.Show(@"Error Submit" + i.Message);
            }
        }
示例#5
0
        private void btn_Start_Submit_Click(object sender, EventArgs e)
        {
            try
            {
                Global.DbBpo.UpdateTimeLastRequest(Global.StrToken);
                //Kiểm tra token
                var token = (from w in Global.DbBpo.tbl_TokenLogins where w.UserName == Global.StrUsername && w.IDProject == Global.StrIdProject select w.Token).FirstOrDefault();

                if (token != Global.StrToken)
                {
                    MessageBox.Show(@"User logged on to another PC, please login again!");
                    DialogResult = DialogResult.Yes;
                }
                if (btn_Start_Submit.Text == @"Start")
                {
                    if (string.IsNullOrEmpty(Global.StrBatch))
                    {
                        MessageBox.Show(@"Please log in again and select Batch!");
                        return;
                    }

                    string temp = GetImage();
                    if (temp == "NULL")
                    {
                        var listResult = Global.Db.GetBatNotFinishDeSo(Global.StrUsername).ToList();
                        if (listResult.Count > 0)
                        {
                            if (MessageBox.Show(@"Batch next is: " + listResult[0].fbatchname + "\nWould you like to continue??", "Notification!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                Global.StrBatch    = listResult[0].fbatchname;
                                lb_fBatchName.Text = Global.StrBatch;
                                lb_IdImage.Text    = "";
                                lb_TongSoHinh.Text =
                                    (from w in Global.Db.tbl_Images where w.fbatchname == Global.StrBatch select w.idimage).Count().ToString();
                                lb_SoHinhConLai.Text  = (from w in Global.Db.tbl_Images where w.ReadImageDESo < 2 && w.fbatchname == Global.StrBatch && (w.UserNameDESo != Global.StrUsername || w.UserNameDESo == null || w.UserNameDESo == "") select w.idimage).Count().ToString();
                                lb_SoHinhLamDuoc.Text = (from w in Global.Db.tbl_MissImage_DESOs where w.UserName == Global.StrUsername && w.fBatchName == Global.StrBatch select w.IdImage).Count().ToString();

                                SetValue();
                                btn_Start_Submit.Text = @"Start";
                                btn_Start_Submit_Click(null, null);
                            }
                            else
                            {
                                btn_Logout_ItemClick(null, null);
                            }
                        }
                        else
                        {
                            MessageBox.Show(@"Picture is out!");
                            btn_Logout_ItemClick(null, null);
                        }
                    }
                    else if (temp == "Error")
                    {
                        MessageBox.Show(@"Can not load image!");
                        btn_Logout_ItemClick(null, null);
                    }
                    UcNatsu1.ResetData();

                    btn_Start_Submit.Text     = @"Submit";
                    btn_Submit_Logout.Visible = true;
                }
                else
                {
                    if (Global.StrRole == "DESO")
                    {
                        if (UcNatsu1.IsEmpty())
                        {
                            if (MessageBox.Show(@"You are empty one or more fields.Do you want to submit ? \r\nYes = Submit and next Image < Press Enter >\r\nNo = Enter the blank field for this image. < Press N > ", @"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                            {
                                return;
                            }
                        }
                        UcNatsu1.SaveData(lb_IdImage.Text);
                        UcNatsu1.ResetData();
                        string temp = GetImage();
                        if (temp == "NULL")
                        {
                            var listResult = Global.Db.GetBatNotFinishDeSo(Global.StrUsername).ToList();
                            if (listResult.Count > 0)
                            {
                                if (MessageBox.Show(@"Batch next is: " + listResult[0].fbatchname + "\nWould you like to continue??", @"Notification!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                {
                                    Global.StrBatch    = listResult[0].fbatchname;
                                    lb_fBatchName.Text = Global.StrBatch;
                                    lb_IdImage.Text    = "";
                                    lb_TongSoHinh.Text =
                                        (from w in Global.Db.tbl_Images where w.fbatchname == Global.StrBatch select w.idimage).Count().ToString();
                                    lb_SoHinhConLai.Text  = (from w in Global.Db.tbl_Images where w.ReadImageDESo < 2 && w.fbatchname == Global.StrBatch && (w.UserNameDESo != Global.StrUsername || w.UserNameDESo == null || w.UserNameDESo == "") select w.idimage).Count().ToString();
                                    lb_SoHinhLamDuoc.Text = (from w in Global.Db.tbl_MissImage_DESOs where w.UserName == Global.StrUsername && w.fBatchName == Global.StrBatch select w.IdImage).Count().ToString();

                                    SetValue();
                                    btn_Start_Submit.Text = @"Start";
                                    btn_Start_Submit_Click(null, null);
                                }
                                else
                                {
                                    btn_Logout_ItemClick(null, null);
                                }
                            }
                            else
                            {
                                MessageBox.Show(@"Picture is out!");
                                btn_Logout_ItemClick(null, null);
                            }
                        }
                        else if (temp == "Error")
                        {
                            MessageBox.Show(@"Can not load image!");
                            btn_Logout_ItemClick(null, null);
                        }
                    }
                    SetValue();
                }
            }
            catch (Exception i)
            {
                MessageBox.Show(@"Error Submit" + i.Message);
            }
        }