示例#1
0
        /// <summary>
        /// Print and Export
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void printPreviewBarExport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                switch (this.repotPrint.Report.ToString())
                {
                case "HTN.BITS.UIL.PLASESS.Reports.RPT_PRODUCT_CARD":
                    if (this.logPrintTime)
                    {
                        UiUtility.UpdatePrintTime(this.seqNo, this.repotPrint.Parameters["paramUserPrint"].Value.ToString());
                    }
                    break;

                case "HTN.BITS.UIL.PLASESS.Reports.RPT_PRODUCT_CARD_8545":
                    if (this.logPrintTime)
                    {
                        UiUtility.UpdatePrintTime(this.seqNo, this.repotPrint.Parameters["paramUserPrint"].Value.ToString());
                    }
                    break;

                default:
                    //nothing
                    break;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error printPreviewBarItem9_ItemClick", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
示例#2
0
        //protected void SaveGridLayout(string formName, BaseView view)
        //{
        //    string stateLayoutPath = UiUtility.StateConfigPath;
        //    string formFileName = string.Empty;
        //    string filename = string.Format("{0}\\{1}_{2}.xml", stateLayoutPath, formName, view.Name);

        //    //Check Exist Directory
        //    if (!Directory.Exists("GridLayout"))
        //    {
        //        Directory.CreateDirectory("GridLayout");
        //    }

        //    using (FileStream stream = new FileStream(filename, FileMode.Create))
        //    {
        //        view.SaveLayoutToStream(stream, DevExpress.Utils.OptionsLayoutBase.FullLayout);
        //        stream.Close();
        //    }
        //}

        //protected void LoadGridLayout(string formName, BaseView view)
        //{
        //    string stateLayoutPath = UiUtility.StateConfigPath;
        //    string filename = string.Format("{0}\\{1}_{2}.xml", stateLayoutPath, formName, view.Name);
        //    if (File.Exists(filename))
        //    {
        //        view.RestoreLayoutFromXml(filename, DevExpress.Utils.OptionsLayoutBase.FullLayout);
        //    }
        //}

        //test
        protected void LoadFormLayout()
        {
            string stateLayoutPath = string.Format("{0}\\{1}", Application.StartupPath, UiUtility.StateConfigPath);
            string formFileName    = string.Format("{0}\\{1}.xml", stateLayoutPath, this.Name);

            FormConfigState formState = null;

            if (File.Exists(formFileName))
            {
                try
                {
                    formState = UiUtility.DeserializeObject <FormConfigState>(formFileName);
                }
                catch (Exception ex)
                {
                    formState = null;
                }

                if (formState != null)
                {
                    if (!formState.FormSize.IsEmpty)
                    {
                        this.Size = formState.FormSize;
                    }
                    if (!formState.FormLocation.IsEmpty)
                    {
                        this.Location = formState.FormLocation;
                    }
                }
            }
        }
示例#3
0
        protected void LoadGridLayout(GridControl grd)
        {
            string stateLayoutPath = string.Format("{0}\\{1}", Application.StartupPath, UiUtility.StateConfigPath);
            string formFileName    = string.Format("{0}\\{1}.xml", stateLayoutPath, this.Name);

            if (File.Exists(formFileName))
            {
                FormConfigState formState = UiUtility.DeserializeObject <FormConfigState>(formFileName);
                if (formState != null)
                {
                    string[] grdArr = Regex.Split(formState.GridControl, @",");
                    int      index  = Array.IndexOf(grdArr, grd.Name);

                    if (index >= 0)
                    {
                        string[] lastViewArr = Regex.Split(formState.LastDefaultView, @",");
                        this.LoadGridLayoutMultipleView(this.Name, grd, lastViewArr[index]);
                    }
                }
            }

            //this.LoadGridLayoutMultipleView(this.Name, grd);
            //all to list;
            if (this.lstGridControl == null)
            {
                this.lstGridControl = new List <GridControl>();
            }

            this.lstGridControl.Add(grd);
        }
示例#4
0
        protected override void OnClosed(EventArgs e)
        {
            #region Create XML Layout

            string        formFileName    = string.Empty;
            string        stateLayoutPath = string.Format("{0}\\{1}", Application.StartupPath, UiUtility.StateConfigPath);
            List <string> gridControlArr  = new List <string>();
            List <string> lastViewArr     = new List <string>();


            if (this.lstGridControl != null)
            {
                foreach (GridControl grd in this.lstGridControl)
                {
                    gridControlArr.Add(grd.Name);
                    lastViewArr.Add(grd.MainView.GetType().Name);

                    this.SaveGridLayoutMultipleView(this.Name, grd);
                }

                this.lstGridControl.Clear();
                this.lstGridControl = null;
            }

            //Check Exist Directory
            if (!Directory.Exists(stateLayoutPath))
            {
                Directory.CreateDirectory(stateLayoutPath);
            }

            FormConfigState formState = new FormConfigState {
                FormName = this.Name, GridControl = string.Join(",", gridControlArr.ToArray()), LastDefaultView = string.Join(",", lastViewArr.ToArray()), FormSize = this.Size, FormLocation = this.Location
            };

            formFileName = string.Format("{0}\\{1}.xml", stateLayoutPath, this.Name);
            UiUtility.SerializeObject(formState, formFileName);

            #endregion

            #region Application Idle Dispose

            //if (this.applicationIdle1.IsRunning)
            //{
            //    this.applicationIdle1.Stop();
            //}

            //this.applicationIdle1.Dispose();

            #endregion

            if (this.processDialog != null)
            {
                this.processDialog = null;
            }

            this.Controls.Clear();

            base.OnClosed(e);
        }
示例#5
0
        protected void LoadGridLayoutMultipleView(string formName, GridControl grd, string lastViewText)
        {
            string stateLayoutPath = string.Format("{0}\\{1}", Application.StartupPath, UiUtility.StateConfigPath);

            string   formFileName = string.Format("{0}\\{1}.xml", stateLayoutPath, formName);
            string   filename     = string.Empty;
            BaseView currentView  = null;

            //if (File.Exists(formFileName))
            //{
            //FormConfigState formState = UiUtility.DeserializeObject<FormConfigState>(formFileName);
            //if (formState != null)
            //{
            //int i = grd.ViewCollection.Count;
            try
            {
                BaseView tView;
                for (int i = 0; i < grd.ViewCollection.Count; i++)
                {
                    tView    = grd.ViewCollection[i];
                    filename = string.Format("{0}\\{1}_{2}.xml", stateLayoutPath, formName, tView.Name);
                    if (File.Exists(filename))
                    {
                        if (UiUtility.IsValidXML(filename))
                        {
                            tView.RestoreLayoutFromXml(filename, DevExpress.Utils.OptionsLayoutBase.FullLayout);
                        }
                    }

                    if (tView.GetType().Name.Equals(lastViewText))
                    {
                        currentView = tView;
                    }
                }

                if (currentView != null)
                {
                    grd.MainView = currentView;
                }
                //}
                //}
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error LoadGridLayoutMultipleView", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
示例#6
0
        public DialogResult GetLogPrintTime()
        {
            DialogResult diResult = DialogResult.None;

            try
            {
                DataTable dtResult;
                using (JobOrderBLL jobOrdBll = new JobOrderBLL())
                {
                    dtResult = jobOrdBll.GetPrintTime(this.seqNo);
                }

                if (dtResult != null)
                {
                    if (dtResult.Rows.Count > 0)
                    {
                        //show popup Message
                        frmCOFPrintCard fCofDocRef = new frmCOFPrintCard()
                        {
                            DT_PRINTED_TIME = dtResult
                        };
                        diResult = UiUtility.ShowPopupForm(fCofDocRef, this, true);
                    }
                    else
                    {
                        diResult = DialogResult.OK;
                    }
                }
                else
                {
                    diResult = DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error GetLogPrintTime", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }

            return(diResult);
        }
示例#7
0
        public void HandleCommand(PrintingSystemCommand command, object[] args, IPrintControl printControl, ref bool handled)
        {
            ReportPrintTool printTool = new ReportPrintTool(this.repotPrint);

            switch (command)
            {
            case PrintingSystemCommand.Print:
                try
                {
                    DialogResult result = this.GetLogPrintTime();
                    if (result == DialogResult.OK)
                    {
                        if (printTool.PrintDialog() ?? false)
                        {
                            //if click print
                            if (this.logPrintTime)
                            {
                                UiUtility.UpdatePrintTime(this.seqNo, this.repotPrint.Parameters["paramUserPrint"].Value.ToString());
                            }

                            if (this.autoCloseAfterPrint)
                            {
                                this.tmrClosePreview.Enabled = true;
                            }
                        }
                    }
                }
                catch (Exception ex) { }

                handled = true;
                break;

            case PrintingSystemCommand.PrintDirect:
                try
                {
                    //DialogResult result = XtraMessageBox.Show(this, "Do you want to print?", "Please Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    DialogResult result = this.GetLogPrintTime();
                    if (result == DialogResult.OK)
                    {
                        printTool.Print();

                        if (this.logPrintTime)
                        {
                            UiUtility.UpdatePrintTime(this.seqNo, this.repotPrint.Parameters["paramUserPrint"].Value.ToString());
                        }

                        if (this.autoCloseAfterPrint)
                        {
                            this.tmrClosePreview.Enabled = true;
                        }
                    }
                }
                catch (Exception ex) { }

                handled = true;
                break;

            default:
                break;
            }
            //if (command == PrintingSystemCommand.Print || command == PrintingSystemCommand.PrintDirect)
            //{
            //    try
            //    {
            //        DialogResult result = XtraMessageBox.Show(this, "Do you want to print?", "Please Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            //        if (result == DialogResult.Yes)
            //        {

            //        }
            //        else
            //        {

            //        }

            //        //ReportPrintTool printTool = new ReportPrintTool(this.repotPrint);
            //        //if (printTool.PrintDialog() ?? false)
            //        //{
            //        //    result = DialogResult.OK;
            //        //}
            //        //else
            //        //    result = DialogResult.Cancel;

            //        //result =printTool.PreviewForm.ShowDialog();

            //    }
            //    catch (Exception) { }
            //    finally
            //    {
            //        // Actually printed?
            //        //this.PrintResult = result;
            //    };

            //    // Set handled to true to avoid the standard procedure to be called.
            //    handled = true;
            //};
            //throw new NotImplementedException();
        }