Пример #1
0
        public static bool Insert(WorkerLoginModel model)
        {
            var @CardId               = new SqlParameter("@CardId", model.CardId);
            var @WorkerId             = new SqlParameter("@WorkerId", model.WorkerId);
            var @LineId               = new SqlParameter("@LineId", model.LineId);
            SaovietCheckInEntities db = new SaovietCheckInEntities();

            if (db.ExecuteStoreCommand("EXEC spm_InsertWorkerLogin @CardId,@WorkerId,@LineId", @CardId, @WorkerId, @LineId) >= 1)
            {
                return(true);
            }
            return(false);
        }
Пример #2
0
        public MainWindow(SectionModel section)
        {
            InitializeComponent();
            this.section = section;
            bwLoadData   = new BackgroundWorker();
            bwLoadData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwLoadData_RunWorkerCompleted);
            bwLoadData.DoWork             += new DoWorkEventHandler(bwLoadData_DoWork);
            lineList            = new List <LineModel>();
            personalList        = new List <PersonalModel>();
            sourceList          = new List <SourceModel>();
            workerLoginList     = new List <WorkerLoginModel>();
            workerLoginViewList = new ObservableCollection <WorkerLoginViewModel>();
            bwInsertWorkerLogin = new BackgroundWorker();
            bwInsertWorkerLogin.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwInsertWorkerLogin_RunWorkerCompleted);
            bwInsertWorkerLogin.DoWork             += new DoWorkEventHandler(bwInsertWorkerLogin_DoWork);
            workerLoginToImport     = new WorkerLoginModel();
            workerLoginViewToImport = new WorkerLoginViewModel();
            resultInsert            = false;

            threadOtherDate                     = new BackgroundWorker();
            threadOtherDate.DoWork             += new DoWorkEventHandler(threadOtherDate_DoWork);
            threadOtherDate.RunWorkerCompleted += new RunWorkerCompletedEventHandler(threadOtherDate_RunWorkerCompleted);
            lineAllList = new List <LineModel>();
        }
Пример #3
0
        private void bwPrint_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            DataTable dt = new ExcessWorkerDataSet().Tables["ExcessWorkerTable"];

            foreach (PersonalModel personal in personalList)
            {
                SourceModel      source      = sourceList.Where(s => s.CardId == personal.CardId).OrderBy(s => s.Time).LastOrDefault();
                WorkerLoginModel workerLogin = workerLoginList.Where(w => w.CardId == personal.CardId && w.WorkerId == personal.WorkerId).FirstOrDefault();
                if (source != null && workerLogin == null)
                {
                    DataRow dr = dt.NewRow();
                    dr["WorkerId"] = personal.WorkerId;
                    dr["Name"]     = personal.Name;
                    dr["Line"]     = personal.Department;
                    dr["Position"] = personal.Position;

                    dt.Rows.Add(dr);
                }
            }

            ReportParameter rp1 = new ReportParameter("Date", String.Format("{0:dd/MM/yyyy}", date));

            ReportDataSource rds = new ReportDataSource();

            rds.Name  = "ExcessWorker";
            rds.Value = dt;

            //reportViewer.LocalReport.ReportPath = @"C:\Users\IT02\Documents\Visual Studio 2010\Projects\Sewing Office Solution\SewingIncentives\Reports\ExcessWorkerReport.rdlc";
            reportViewer.LocalReport.ReportPath = @"Reports\ExcessWorkerReport.rdlc";
            reportViewer.LocalReport.SetParameters(new ReportParameter[] { rp1 });
            reportViewer.LocalReport.DataSources.Add(rds);
            reportViewer.RefreshReport();

            btnPrint.IsEnabled = true;
            this.Cursor        = null;
        }
Пример #4
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            string cardId = txtCardId.Text;

            if (chbOtherDate.IsChecked == true)
            {
                if (threadOtherDate.IsBusy == false)
                {
                    this.Cursor         = Cursors.Wait;
                    txtCardId.IsEnabled = false;

                    DateTime      date      = dpOtherDate.SelectedDate.Value.Date;
                    List <Object> arguments = new List <Object>();
                    arguments.Add(cardId);
                    arguments.Add(date);
                    threadOtherDate.RunWorkerAsync(arguments);
                }
            }
            else
            {
                PersonalModel personal = personalList.Where(p => p.CardId == cardId || p.WorkerId == cardId).FirstOrDefault();
                if (personal == null)
                {
                    MessageBox.Show("This Worker Not Found!", this.Title, MessageBoxButton.OK, MessageBoxImage.Warning);
                    txtCardId.Focus();
                    txtCardId.SelectAll();
                    return;
                }
                workerLoginViewToImport = workerLoginViewList.Where(w => w.CardId == personal.CardId && w.WorkerId == personal.WorkerId).FirstOrDefault();
                if (workerLoginViewToImport != null)
                {
                    dgWorkerLogin.SelectedItem = workerLoginViewToImport;
                    string    lineWork = workerLoginViewToImport.LineWork;
                    LineModel line     = lineList.Where(l => l.LineId == lineWork).FirstOrDefault();
                    if (line != null)
                    {
                        lineWork = line.Name;
                    }
                    MessageBox.Show(String.Format("Id: {0}\nName: {1}\nPosition: {2}\nWork at Line: LINE {3}", workerLoginViewToImport.WorkerId, workerLoginViewToImport.Name, workerLoginViewToImport.Position, lineWork), this.Title, MessageBoxButton.OK, MessageBoxImage.Information);
                    txtCardId.Focus();
                    txtCardId.SelectAll();
                    return;
                }
                workerLoginViewToImport = new WorkerLoginViewModel
                {
                    CardId   = personal.CardId,
                    WorkerId = personal.WorkerId,
                    Name     = personal.Name,
                    Line     = personal.Department,
                    LineWork = btnLogin.Tag.ToString(),
                    Position = personal.Position,
                };

                workerLoginToImport = new WorkerLoginModel
                {
                    CardId   = personal.CardId,
                    WorkerId = personal.WorkerId,
                    LineId   = btnLogin.Tag.ToString(),
                };

                if (bwInsertWorkerLogin.IsBusy == false)
                {
                    this.Cursor         = Cursors.Wait;
                    resultInsert        = false;
                    txtCardId.IsEnabled = false;
                    bwInsertWorkerLogin.RunWorkerAsync();
                }
            }
        }