private void GetFromInfo(string FormsID, string MOSecID, string WPID, string WPDesc)
        {
            try
            {
                string GetFormInfoURL = string.Format(@"/api/Forms/GetFormInfo/");
                var    client         = new Mineware.Systems.Production.SysAdminScreens.OCRScheduling.Models.ClientConnect();
                var    param          = new Dictionary <string, string>();
                param.Add("FormID", FormsID);

                var response = System.Threading.Tasks.Task.Run(() => client.GetWithParameters(GetFormInfoURL, param)).Result;

                _Forms = JsonConvert.DeserializeObject <Mineware.Systems.Production.SysAdminScreens.OCRScheduling.Models.FormsAPI>(response);

                _Forms.UniqueDataStructure.TableName = _Forms.TableName;

                if (MoveToProdind == true)
                {
                    _Forms.UniqueDataStructure.Rows[0].Delete();

                    DataRow row;
                    row = _Forms.UniqueDataStructure.NewRow();

                    row["MOSectionID"] = MOSecID;
                    row["Workplaceid"] = WPID;
                    row["Description"] = WPDesc;
                    row["CaptureDate"] = DateTime.Now.ToString("ddMMyyyy");

                    _Forms.UniqueDataStructure.Rows.Add(row);
                }
                else
                {
                    _Forms.UniqueDataStructure.Rows[0].Delete();

                    DataRow row;
                    row = _Forms.UniqueDataStructure.NewRow();

                    row["MOSectionID"] = "EXAMPLE";
                    row["Workplaceid"] = "EXAMPLE";
                    row["Description"] = "EXAMPLE";
                    row["CaptureDate"] = DateTime.Now.ToString("ddMMyyyy");

                    _Forms.UniqueDataStructure.Rows.Add(row);
                }
            }
            catch
            {
            }

            GetReport(FormsID);
            if (MoveToProdind == true)
            {
                MoveToProd();
            }
        }
Esempio n. 2
0
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (OCRCL.SelectedIndex == -1)
            {
                MessageBox.Show(this, "Please select a Form", "Select a Form");
                return;
            }
            if (viewWorkplaces.SelectedRowsCount == 0)
            {
                MessageBox.Show(this, "Please select at least one workplace to print", "Select a workplace");
                return;
            }
            DevExpress.XtraSplashScreen.IOverlaySplashScreenHandle handle = DevExpress.XtraSplashScreen.SplashScreenManager.ShowOverlayForm(this);
            MoveToProdind = true;
            try
            {
                DataTable table = ((DataView)viewWorkplaces.DataSource).Table;
                Int32[]   selectedRowHandles = viewWorkplaces.GetSelectedRows();
                _listForms.Clear();
                for (int i = 0; i < selectedRowHandles.Length; i++)
                {
                    int selectedRowHandle = selectedRowHandles[i];
                    if (selectedRowHandle >= 0)
                    {
                        _listForms.Add(new ListForms {
                            Section  = viewWorkplaces.GetRowCellValue(selectedRowHandle, "Sectionid").ToString()
                            , WPID   = viewWorkplaces.GetRowCellValue(selectedRowHandle, "WorkplaceID").ToString()
                            , WPName = viewWorkplaces.GetRowCellValue(selectedRowHandle, "Description").ToString()
                            , FID    = procs.ExtractBeforeColon(OCRCL.SelectedItem.ToString())
                            , UID    = 0
                        });
                    }
                }

                string GetFormInfoURL = string.Format(@"/api/Forms/GetFormInfo/");
                var    client         = new Models.ClientConnect();
                var    param          = new Dictionary <string, string>();
                param.Add("FormID", procs.ExtractBeforeColon(OCRCL.SelectedItem.ToString()));

                var response = System.Threading.Tasks.Task.Run(() => client.GetWithParameters(GetFormInfoURL, param)).Result;

                _Forms = JsonConvert.DeserializeObject <Models.FormsAPI>(response);

                _Forms.UniqueDataStructure.TableName = _Forms.TableName;

                List <ListForms> _FormsL = new List <ListForms>();
                _FormsL = _listForms.Where(i => i.FID.Contains(procs.ExtractBeforeColon(OCRCL.SelectedItem.ToString()).ToString())).ToList();
                _Forms.UniqueDataStructure.Rows[0].Delete();

                var allResponses = new List <ListForms>();
                for (int i = 0; i < _FormsL.Count; i = i + _PrintBatchNumber)
                {
                    _Forms.UniqueDataStructure.Rows.Clear();
                    foreach (var form in _FormsL.Skip(i).Take(_PrintBatchNumber))
                    {
                        try
                        {
                            DataRow row;
                            row = _Forms.UniqueDataStructure.NewRow();

                            row["MOSectionID"] = form.Section.ToString();
                            row["Workplaceid"] = form.WPID.ToString();
                            row["Description"] = form.WPName.ToString();
                            row["CaptureDate"] = DateTime.Now.ToString("ddMMyyyy");

                            _Forms.UniqueDataStructure.Rows.Add(row);
                        }
                        catch
                        {
                            continue;
                        }
                    }
                    GetReport(procs.ExtractBeforeColon(OCRCL.SelectedItem.ToString()));
                    if (MoveToProdind == true)
                    {
                        //MovetoProd.DoWork += MovetoProd_DoWork;
                        //MovetoProd.RunWorkerAsync();
                        //MovetoProd.RunWorkerCompleted += MovetoProd_RunWorkerCompleted;
                        MoveToProd();
                    }
                }

                DateTime it           = DateTime.Now;
                string   newFolder    = "Mineware_OCR";
                string   newFolderDay = newFolder + @"\" + it.ToString("yyyy'_'MM'_'dd") + "_BulkPrint";
                Process.Start("explorer.exe", newFolderDay);
            }
            catch (Exception error)
            {
                DevExpress.XtraSplashScreen.SplashScreenManager.CloseOverlayForm(handle);
            }
            DevExpress.XtraSplashScreen.SplashScreenManager.CloseOverlayForm(handle);
        }
Esempio n. 3
0
        private void PrintChecklistsBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DevExpress.XtraSplashScreen.IOverlaySplashScreenHandle handle = DevExpress.XtraSplashScreen.SplashScreenManager.ShowOverlayForm(this);
            try
            {
                DataTable table        = ((DataView)viewWorkplaces.DataSource).Table;
                var       myEnumerable = table.AsEnumerable();
                _listForms.Clear();
                _listForms =
                    (from item in myEnumerable
                     select new ListForms
                {
                    Section = item.Field <string>("SectionID"),
                    WPID = item.Field <string>("WorkplaceID"),
                    WPName = item.Field <string>("WPName"),
                    FID = item.Field <string>("ChecklistID"),
                    UID = item.Field <int>("UniqueID")
                }).ToList();

                List <string> ChecklistIDList = table.AsEnumerable().Select(x => x["ChecklistID"].ToString()).Distinct().ToList();

                foreach (var ID in ChecklistIDList)
                {
                    string GetFormInfoURL = string.Format(@"/api/Forms/GetFormInfo/");
                    var    client         = new Models.ClientConnect();
                    var    param          = new Dictionary <string, string>();
                    param.Add("FormID", ID);

                    var response = System.Threading.Tasks.Task.Run(() => client.GetWithParameters(GetFormInfoURL, param)).Result;

                    _Forms = JsonConvert.DeserializeObject <Models.FormsAPI>(response);

                    _Forms.UniqueDataStructure.TableName = _Forms.TableName;

                    List <ListForms> _FormsL = new List <ListForms>();
                    _FormsL = _listForms.Where(i => i.FID.Contains(ID.ToString())).ToList();
                    _Forms.UniqueDataStructure.Rows[0].Delete();
                    foreach (var form in _FormsL)
                    {
                        try
                        {
                            DataRow row;
                            row = _Forms.UniqueDataStructure.NewRow();

                            row["MOSectionID"] = form.Section.ToString();
                            row["Workplaceid"] = form.WPID.ToString();
                            row["Description"] = form.WPName.ToString();
                            row["CaptureDate"] = DateTime.Now.ToString("ddMMyyyy");

                            _Forms.UniqueDataStructure.Rows.Add(row);
                        }
                        catch
                        {
                            continue;
                        }
                    }
                    GetReport(ID);

                    MoveToProd();
                    //if (MoveToProdind == true)
                    //{
                    //MovetoProd.DoWork += MovetoProd_DoWork;
                    //MovetoProd.RunWorkerAsync();

                    // MoveToProd();

                    foreach (var form in _FormsL)
                    {
                        DateTime dt = (DateTime)DateEdit1.EditValue;
                        UpdateSchedule2("Day" + dt.Day.ToString(), form.UID);
                    }
                }
                DateTime it           = DateTime.Now;
                string   newFolder    = "Mineware_OCR";
                string   newFolderDay = newFolder + @"\" + it.ToString("yyyy'_'MM'_'dd");
                Process.Start("explorer.exe", newFolderDay);
            }
            catch
            {
                DevExpress.XtraSplashScreen.SplashScreenManager.CloseOverlayForm(handle);
            }
            DevExpress.XtraSplashScreen.SplashScreenManager.CloseOverlayForm(handle);
        }