示例#1
0
 /// <summary>
 /// Tạo thêm tab mới
 /// </summary>
 /// <param name="tabControl">Tên TabControl để add thêm tabpage mới vào</param>
 /// <param name="Text">Tiêu đề tabpage mới</param>
 /// <param name="Name">Tên tabpage mới</param>
 /// <param name="form">Tên form con của tab mới</param>
 /// <param name="imageIndex">index của icon</param>
 void TabCreating(DevExpress.XtraTab.XtraTabControl tabControl, string Text, string Name, DevExpress.XtraEditors.XtraForm form, int imageIndex)
 {
     DevExpress.XtraTab.XtraTabPage tabpage = new DevExpress.XtraTab.XtraTabPage { Text = Text, Name = Name, ImageIndex = imageIndex };
     tabControl.TabPages.Add(tabpage);
     tabControl.SelectedTabPage = tabpage;
     form.TopLevel = false;
     form.Parent = tabpage;
     form.Show();
 }
示例#2
0
        public void SearchPo(DevExpress.XtraGrid.GridControl _Grid, DevExpress.XtraEditors.TextEdit _TextBox, DevExpress.XtraEditors.SimpleButton _Btn)
        {

            try
            {


                //create expression 
                ParameterExpression argParam = Expression.Parameter(typeof(PurchaseOrderHeader), "s");
                Expression nameProperty = Expression.Property(argParam, "PurchaseOrderHeaderID");
                Expression nameProperty2 = Expression.Property(argParam, "StyleID");




                var val1 = Expression.Constant(_TextBox.Text);
                var val2 = Expression.Constant(_TextBox.Text);
                //expresttion 1 
                Expression e1 = Expression.Call(nameProperty, "Contains", null, val1);
                // expresstion 2
                Expression e2 = Expression.Call(nameProperty2, "Contains", null, val2);
                var andExp = Expression.Or(e1, e2);


                // get expresttion to labda objet 
                var lambda1 = Expression.Lambda<Func<PurchaseOrderHeader, bool>>(andExp, argParam);
                // pass object to query 
                var selected = from item in _PoRepository.SearchFor(lambda1).ToList() select new { item.StyleID,item.Style.Buyer.BuyerName, item.PurchaseOrderHeaderID, item.StartDate, item.EndDate };

                //check is record exist in selected item
                if (selected.Count() > 0)
                {
                    _Grid.Show();
                    _Btn.Show();

                    _Grid.DataSource = selected;
                }
                else
                {
                    _Grid.DataSource = null;
                }



            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message, "Error - B-0002", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }




        }
 private void Addtabpage(DevExpress.XtraEditors.XtraUserControl frm, string tabname)
 {
     DevExpress.XtraTab.XtraTabPage tab = new DevExpress.XtraTab.XtraTabPage();
     tab.Text = tabname;
     //frm.TopLevel = false;
     frm.Show();
     frm.Parent = tab;
     //tab.Controls.Add(frm);
     bool kt = false;
     foreach (DevExpress.XtraTab.XtraTabPage tabitem in xtraTab.TabPages)
     {
         if (tabitem.Text == tabname)
         {
             xtraTab.SelectedTabPage = tabitem;
              
             kt = true;
         }
     }
     if (!kt)
     {
         xtraTab.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { tab });
     }
 }
示例#4
0
        /// <summary>
        /// Tạo thêm tab mới
        /// </summary>
        /// <param name="tabControl">Tên TabControl để add thêm tabpage mới vào</param>
        /// <param name="Text">Tiêu đề tabpage mới</param>
        /// <param name="Name">Tên tabpage mới</param>
        /// <param name="form">Tên form con của tab mới</param>
        /// <param name="imageIndex">index của icon</param>
        void TabCreating(DevExpress.XtraTab.XtraTabControl tabControl, string Text, string Name, DevExpress.XtraEditors.XtraForm form, int imageIndex)
        {
            int index = KiemTraTonTai(tabControl, Name);
            if (index >= 0)
            {
                tabControl.SelectedTabPage = tabControl.TabPages[index];
                tabControl.SelectedTabPage.Text = Text;
            }
            else
            {
                DevExpress.XtraTab.XtraTabPage tabpage = new DevExpress.XtraTab.XtraTabPage { Text = Text, Name = Name, ImageIndex = imageIndex };
                tabControl.TabPages.Add(tabpage);
                tabControl.SelectedTabPage = tabpage;

                form.TopLevel = false;
                form.Parent = tabpage;
                form.Show();
                form.Dock = DockStyle.Fill;
            }
        }
示例#5
0
        public  BindingList<OperationPool> ReadMyExcel(DevExpress.XtraEditors.ProgressBarControl bar )
        {
            
            TempOpration t = new TempOpration();
            bar.Show();
            bar.Properties.Maximum = lastRow;
            bar.Properties.Step = 1;
            oprationList.Clear();
            // EmpList.Clear();
            for (int index = 5; index <= lastRow; index++)
            {
                System.Array MyValues = (System.Array)MySheet.get_Range("A" + index.ToString(), "G" + index.ToString()).Cells.Value;

                string opration = "";
                string _OprationName = "";
                string _MachineType = "None";
                string _SMVtype = "none";
                string _SMV = "";
                string _PartName = "None";
                string _OprationRole = "None";
                string _OprationGrade = "None";
                bool _hasData = false;
                
                if (MySheet.Cells[index, 1].Value != null) {
                    opration = (string)(MySheet.Cells[index, 1].Value.ToString());
                    t.OprationID = opration;
                    _hasData = true;
                   // Debug.WriteLine(opration);

                }
               

              

                if (MySheet.Cells[index, 2].Value != null)
                {
                    _OprationName = (string)(MySheet.Cells[index, 2].Value.ToString());
                    t.OparationName = _OprationName;
                    if (MySheet.Cells[index, 1].Value != null)
                    {

                    }
                    else {
                        t.PartName = t.OparationName;
                       
                    }
                   

                }

             if (MySheet.Cells[index, 3].Value != null)
                {
                    _MachineType = (string)(MySheet.Cells[index, 3].Value.ToString());
                    t.MachineType = _MachineType;
                   // Debug.WriteLine(opration);

                }

            if (MySheet.Cells[index, 4].Value != null)
                {
                    _SMVtype = (string)(MySheet.Cells[index, 4].Value.ToString());
                    t.SMVType = _SMVtype;
                   // D ebug.WriteLine(opration);

                }

            if (MySheet.Cells[index, 6].Value != null)
                {
                    _SMV = (string)(MySheet.Cells[index, 6].Value.ToString());
                    _SMVtype = "M/C";


                    try {
                        t.SMV = Convert.ToDouble(_SMV);
                        t.SMVType = _SMVtype;
                    }
                catch(Exception ex){
                    t.SMV = 0;
                    t.SMVType = _SMVtype;
                    Debug.WriteLine(ex.Message);
                }
                 
                   // D ebug.WriteLine(opration);

                }


                 if (MySheet.Cells[index, 7].Value != null)
                {
                    _SMV = (string)(MySheet.Cells[index, 7].Value.ToString());
                    _SMVtype = "M/A";

                    try {
                        t.SMV = Convert.ToDouble(_SMV);
                        t.SMVType = _SMVtype;
                    }
                     catch(Exception ex){
                         t.SMV = 0;
                         t.SMVType = _SMVtype;
                         Debug.WriteLine(ex.Message);
                     }
                
                   // D ebug.WriteLine(opration);

                }

                 if (MySheet.Cells[index, 8].Value != null)
                 {
                     _OprationRole = (string)(MySheet.Cells[index, 8].Value.ToString());
                     t.OprationRole = _OprationRole;
                     // D ebug.WriteLine(opration);

                 }
                 else {
                     t.OprationRole ="None";
                 }

                 if (MySheet.Cells[index, 9].Value != null)
                 {
                     _OprationGrade = (string)(MySheet.Cells[index, 9].Value.ToString());
                     t.OprationGrade = _OprationGrade;
                     // D ebug.WriteLine(opration);

                 }
                 else {
                     t.OprationGrade = "None";
                 }

                 GenaricRepository<TempOpration> _TempOprationRepository = new GenaricRepository<TempOpration>(new ItrackContext());
               
                bar.PerformStep();
               
                if (_hasData == true && GetoprationByID(t.OprationID).Count == 0)
                {

                    
                    _TempOprationRepository.Insert(t);
                }

                //oprationList.Add(new OperationPool
                // {

                //     OperationPoolID = MyValues.GetValue(1, 1).ToString(),
                //     OpationName = MyValues.GetValue(1, 2).ToString(),
                //     MachineType = MyValues.GetValue(1, 3).ToString(),
                //     SMVType = MyValues.GetValue(1, 4).ToString(),
                //     SMV = Convert.ToDouble(MyValues.GetValue(1, 4).ToString())
                // });


                                        

                
            }

            bar.Hide();
            
            return oprationList;
        }
示例#6
0
        public static void ShowWindow(DevExpress.XtraEditors.XtraForm mainForm,
            DevExpress.XtraEditors.XtraForm form, bool isWait, IFormat isFormat,
            IPermission isPermision, bool ignoreCheckShowForm)
        {
            //if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
            //if (isWait) FrameworkParams.wait = new WaitingMsg();
            ////Kích hoạt menu đang mở nếu đã mở
            //foreach (Form f in mainForm.MdiChildren)
            //{
            //    if (f.Text.Equals(form.Text) && f.Controls.Count == form.Controls.Count)
            //    {
            //        f.Activate();
            //        return;
            //    }
            //}
            if (ignoreCheckShowForm == false)
            {
                if (HelpPermission.CanShowForm(form) == false)
                {
                    ApplyPermissionAction.getPermissionFormFail().ShowDialog();
                    form.Dispose();
                    return;
                }
            }

            try
            {
                if (form.IsDisposed) return;

                HelpUserLog.logOpenForm(form);
                PLPlugin.HookShowAllPlugin(form);

                form.FormClosed += new FormClosedEventHandler(form_FormClosed);
                //form.Disposed += new EventHandler(form_Disposed);

                form.MdiParent = mainForm;
                form.MinimizeBox = false;
                form.WindowState = FormWindowState.Maximized;
                form.ShowInTaskbar = false;
                form.Icon = FrameworkParams.ApplicationIcon;

                ProtocolForm.pl_wrapper(ref form, isFormat, isPermision);

                form.Shown += new EventHandler(wait);
                //DEVEXPRESS
                if (FrameworkParams.UsingRightClickForm) HelpXtraForm.PopupRightClickForm(form);

                if (form is frmPermissionFail)
                    form.ShowDialog(FrameworkParams.MainForm);
                else
                    form.Show();
            }
            catch (Exception ex)
            {
                PLException.AddException(ex);
                PLMessageBox.ShowSystemErrorMessage(ex.ToString());
            }
        }
       public static async Task<bool> DoDayend(  Label lbl,DevExpress.XtraWaitForm.ProgressPanel pnl,DateTime _now) {
           try {

               lbl.Text = "Calculating Production Figures..";
               pnl.Show();
               await Task.Run(() =>
               {
                 
                   

                //   AddIndividualProductionSummary(_now,txt);
               
               });

               lbl.Text = "Sucecessfuly Completed !";
               pnl.Hide();
               return true;
           }
           catch(Exception ex){
               Debug.WriteLine(ex.Message);
               return false;
           }
       }
示例#8
0
 private void ShowCustomForm(DevExpress.XtraEditors.XtraForm frm)
 {
     frm.MdiParent = (System.Windows.Forms.Form)Application.MainWindow.Template;
     frm.Show();
 }