Exemplo n.º 1
0
        private void cbCod_method_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit Edit;
            Edit = ((DevExpress.XtraEditors.LookUpEdit)sender).Properties;

            if (e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
            {
                return;
            }
            List <CMr> lstMr = (List <CMr>)cbCodMR.Properties.DataSource;
            CMr        oMr   = new CMr();

            oMr.Cod_mr = e.DisplayValue.ToString();
            oMr.Idmr   = -100;

            lstMr.Add(oMr);

            cbCodMR.Properties.DataSource = lstMr;

            // --- referencia material detail
            CMr_detail               oMr_detail   = new CMr_detail();
            CMr_detailFactory        faMr_detail  = new CMr_detailFactory();
            BindingList <CMr_detail> lstMr_detail = new BindingList <CMr_detail>(new LimsProject.BusinessLayer.Modules.ModMaterialReference().SelectByMr(0));

            gcMaterialReference.DataSource = lstMr_detail;

            // --- jar detail
            CMr_jarFactory        faMr_jar  = new CMr_jarFactory();
            CMr_jar               oMr_jar   = new CMr_jar();
            BindingList <CMr_jar> lstMr_jar = new BindingList <CMr_jar>(new LimsProject.BusinessLayer.Modules.ModMaterialReference().GetJarByMr(0));

            gcOpenCloseJar.DataSource = lstMr_jar;

            e.Handled = true;
        }
        /// <summary>
        /// 实现在列表没有记录的时候,可以录入一个不存在的记录,类似ComoboEidt功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void CustomGridLookUpEdit_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            if (!DisableAddNew && !this.DesignMode)
            {
                string displayName = this.Properties.DisplayMember;
                string valueName   = this.Properties.ValueMember;
                string display     = e.DisplayValue.ToString();

                DataTable dtTemp = this.Properties.DataSource as DataTable;
                if (dtTemp != null)
                {
                    DataRow[] selectedRows = dtTemp.Select(string.Format("{0}='{1}'", displayName, display.Replace("'", "‘")));
                    if (selectedRows == null || selectedRows.Length == 0)
                    {
                        DataRow row = dtTemp.NewRow();
                        row[displayName] = display;
                        row[valueName]   = display;
                        dtTemp.Rows.Add(row);
                        dtTemp.AcceptChanges();
                    }
                }

                e.Handled = true;
            }
        }
Exemplo n.º 3
0
        private void cboEquipmentType_Properties_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            try
            {
                if (MessageBox.Show(this, "Add the '" + e.DisplayValue.ToString() + "' entry to the list?",
                                    "Confirm", MessageBoxButtons.YesNo) == DialogResult.No && (string)e.DisplayValue == String.Empty)
                {
                    return;
                }

                using (UnitOfWork unitOfWork = new UnitOfWork())
                {
                    unitOfWork.EquipmentTypesRepo.Insert(new EquipmentTypes()
                    {
                        EquipmentType = e.DisplayValue.ToString()
                    });
                    unitOfWork.Save();
                    EquipmentTypeBindingSource.DataSource = unitOfWork.EquipmentTypesRepo.Get();
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 4
0
 void Properties_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(e.DisplayValue.ToString()))
     {
         this.Text = null;
     }
 }
Exemplo n.º 5
0
 void edit_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     _MyObject.DisplayText = e.DisplayValue;
     this.popupOpened      = false;
     edit.Properties.View.DataController.DoRefresh();
     e.Handled = true;
 }
Exemplo n.º 6
0
 private void repositoryItemLookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     DevExpress.XtraEditors.LookUpEdit look = sender as DevExpress.XtraEditors.LookUpEdit;
     //DataRowView view = this.bindingSource1.Current as DataRowView;
     //if (view!=null)
     //{
     //    view.Row.BeginEdit();
     //    view.Row["Feature"]=look.Text;
     //    view.Row.EndEdit();
     //}
     if (string.IsNullOrEmpty(e.DisplayValue.ToString()))
     {
         Alert("请正确填写费用代码!");
     }
     else
     {
         if (this.Filter.Contains(e.DisplayValue.ToString()))
         {
             Alert("费用代码已经被使用!");
         }
         else
         {
             look.EditValue = e.DisplayValue;
         }
     }
 }
Exemplo n.º 7
0
 private void lookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     if (lookUpEdit1.Text.Trim().Length > 0)
     {
         if (DialogResult.Yes == XtraMessageBox.Show("刚才所填是否为新色号?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
         {
             string    bll   = "Hownet.BLL.Color";
             DataTable dtTem = dtColor.Clone();
             DataRow   dr    = dtTem.NewRow();
             dr["A"]           = 3;
             dr["ID"]          = 0;
             dr["Sn"]          = string.Empty;
             dr["Name"]        = lookUpEdit1.Text;
             dr["Value"]       = 0;
             dr["IsEnd"]       = 0;
             dr["IsUse"]       = 1;
             dr["ColorTypeID"] = 0;
             dr["Remark"]      = string.Empty;
             dtTem.Rows.Add(dr);
             int _temID = 0;
             dr["ID"] = _temID = BasicClass.GetDataSet.Add(bll, dtTem);
             dtColor.Rows.Add(dr.ItemArray);
             lookUpEdit1.EditValue = _temID;
         }
         else
         {
             lookUpEdit1.EditValue = 0;
             lookUpEdit1.Text      = string.Empty;
         }
     }
 }
Exemplo n.º 8
0
Arquivo: M12.cs Projeto: TPF-TUW/MDS
 private void glueCode_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     //GridLookUpEdit gridLookup = sender as GridLookUpEdit;
     //if (e.DisplayValue == null) return;
     //string newValue = e.DisplayValue.ToString();
     //if (newValue == String.Empty) return;
 }
Exemplo n.º 9
0
        private void cbCompany_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            // clear fields
            cbCompany.Text        = "";
            tbClientRuc.Text      = "";
            tbClientDomicile.Text = "";
            tbClientPhone.Text    = "";
            tbFax.Text            = "";
            gcContact.DataSource  = null;

            DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit Edit;
            Edit = ((DevExpress.XtraEditors.LookUpEdit)sender).Properties;

            if (e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
            {
                return;
            }

            List <CCompany> ListCompanies = (List <CCompany>)cbCompany.Properties.DataSource;

            ListCompanies.Add(new CCompany {
                Idcompany = 0, Business_name = e.DisplayValue.ToString()
            });
            cbCompany.Properties.DataSource = ListCompanies;

            // --- add contacts
            Reception oReception = new BusinessLayer.Modules.Reception();

            gcContact.DataSource = new BindingList <CContact>(oReception.GetLstContactsByCompany(0));

            e.Handled = true;
        }
        private void factString_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            var newFactString = factString.Text;

            viewModel.CannedMessages.Add(newFactString);
            factString.EditValue = viewModel.FactString = newFactString;
            e.Handled            = true;
        }
Exemplo n.º 11
0
 private void LuNguoiNop_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     e.DisplayValue = DC2.xuly(e.DisplayValue.ToString());
     if (e.DisplayValue.ToString().Length > 0)
     {
         dtnop.Rows.Add(DC2.xuly(e.DisplayValue.ToString()));
     }
     e.Handled = true;
 }
Exemplo n.º 12
0
        private void lookupFormat_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            var newRecord = dsFormat.FirstOrDefault(r => r.EmployeeListFormatID == -1);

            if (newRecord != null)
            {
                newRecord.EmployeeListFormatName = e.DisplayValue.ToString();
                e.Handled = true;
                lookupFormat.EditValue = -1;
            }
        }
Exemplo n.º 13
0
        private void railcarNumber_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            Prizm.Domain.Entity.Mill.Railcar r = new Prizm.Domain.Entity.Mill.Railcar
            {
                Number      = railcarNumber.Text,
                Certificate = "",
                Destination = ""
            };

            viewModel.Railcars.Add(r);
            railcarNumber.EditValue = viewModel.Railcar = r;
            e.Handled = true;
        }
Exemplo n.º 14
0
 private void cmbSearch_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     try
     {
         //string query = cmbSearch.Text;
         //var list = (from s in db.Items.Local where s.Name.Contains(query) select s).ToList();
         //itemBindingSource.DataSource = list;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 15
0
        private void glueLineName_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            GridLookUpEdit gridLookup = sender as GridLookUpEdit;

            if (e.DisplayValue == null)
            {
                return;
            }
            string newValue = e.DisplayValue.ToString();

            if (newValue == String.Empty)
            {
                return;
            }
        }
Exemplo n.º 16
0
 private void ordersLookUp_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(e.DisplayValue.ToString()))
     {
         if (MessageBox.Show(
                 string.Format(Program.LanguageManager.GetString(StringResources.MillPipe_NewPurchaseOrderQuestion), e.DisplayValue.ToString()),
                 Program.LanguageManager.GetString(StringResources.MillPipe_NewPurchaseOrderQuestionHeader),
                 MessageBoxButtons.YesNo)
             == System.Windows.Forms.DialogResult.Yes)
         {
             ShowOrderDialog(e.DisplayValue.ToString());
         }
     }
     e.Handled = true;
 }
Exemplo n.º 17
0
 private void Txt_Category_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     if (e.DisplayValue is string st && st.Trim() != string.Empty)
     {
         var newObject = new product_categories()
         {
             name = st, parent_id = 0, number = "0"
         };
         using (SalesDataContext db = new SalesDataContext())
         {
             db.product_categories.InsertOnSubmit(newObject);
             db.SubmitChanges();
         }
         ((List <product_categories>)Txt_Category.Properties.DataSource).Add(newObject);
         e.Handled = true;
     }
 }
Exemplo n.º 18
0
 private void Lkp_Category_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     if (e.DisplayValue is string st && st.Trim() != string.Empty)
     {
         var newObject = new DAL.ProductCategory()
         {
             Name = st, ParentID = 0, Number = "0"
         };
         using (var db = new DAL.dbDataContext())
         {
             db.ProductCategories.InsertOnSubmit(newObject);
             db.SubmitChanges();
         }
         ((List <DAL.ProductCategory>)lkp_Category.Properties.DataSource).Add(newObject);
         e.Handled = true;
     }
 }
Exemplo n.º 19
0
 private void UpEdit_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     if (e.DisplayValue is string st && st.Trim() != string.Empty)
     {
         var newObject = new units()
         {
             name = st.Trim()
         };
         using (SalesDataContext db = new SalesDataContext())
         {
             db.units.InsertOnSubmit(newObject);
             db.SubmitChanges();
         }
         ((List <units>)upEdit.DataSource).Add(newObject);
         ((List <units>)(((LookUpEdit)sender).Properties.DataSource)).Add(newObject);
         e.Handled = true;
     }
 }
Exemplo n.º 20
0
        private void gluCod_method_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            try
            {
                DevExpress.XtraEditors.Repository.RepositoryItemGridLookUpEdit Edit;
                Edit = ((DevExpress.XtraEditors.GridLookUpEdit)sender).Properties;

                if (e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
                {
                    return;
                }

                List <CTemplate_method> lstCtm = (List <CTemplate_method>)gluCod_method.Properties.DataSource;

                // --- allways keeping one record how new value
                if (lstCtm.Exists(c => c.Idtemplate_method == 0))
                {
                    CTemplate_method oTemplate_method = lstCtm.Single(c => c.Idtemplate_method == 0);
                    oTemplate_method.Cod_template_method = e.DisplayValue.ToString();
                    gluCod_method.Properties.DataSource  = lstCtm;
                }
                else
                {
                    List <CTemplate_method> lstTemplateMethod = new Methods().GetAllLastVersionMethods();
                    if (!lstTemplateMethod.Exists(c => c.Cod_template_method == gluCod_method.Text.Trim()))
                    {
                        lstCtm.Add(new CTemplate_method()
                        {
                            Cod_template_method = e.DisplayValue.ToString(),
                            Idtemplate_method   = 0
                        });
                        gluCod_method.Properties.DataSource = lstCtm;
                    }
                }

                e.Handled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 21
0
        private void cbNomReactives_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit Edit;
            Edit = ((DevExpress.XtraEditors.LookUpEdit)sender).Properties;

            if (e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
            {
                return;
            }
            List <CReactive> lstReactives = (List <CReactive>)cbFormula.Properties.DataSource;
            CReactive        oReactive    = new CReactive();

            oReactive.Idreactive       = 0;
            oReactive.Chemical_formula = cbFormula.Text;
            lstReactives.Add(oReactive);

            cbFormula.Properties.DataSource = lstReactives;

            e.Handled = true;
        }
Exemplo n.º 22
0
        private void RepoUOM_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            if (e.DisplayValue is string value && value.Trim() != string.Empty)
            {
                var NewObject = new DAL.UnitName()
                {
                    Name = value.Trim()
                };
                using (DAL.dbDataContext db = new DAL.dbDataContext())
                {
                    db.UnitNames.InsertOnSubmit(NewObject);
                    db.SubmitChanges();
                }

                ((List <DAL.UnitName>)repoUOM.DataSource).Add(NewObject);
                ((List <DAL.UnitName>)((LookUpEdit)sender).Properties.DataSource).Add(NewObject);

                e.Handled = true;
            }
        }
Exemplo n.º 23
0
        private void lueFontSize_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            List <double> source = (List <double>)(sender as LookUpEdit).Properties.DataSource;

            if (source != null)
            {
                string s = (sender as LookUpEdit).Text;
                if (s.Length > 0)
                {
                    double temp = 0;
                    double.TryParse(s, out temp);
                    if (temp > 0)
                    {
                        source.Add(temp);
                        e.DisplayValue = temp;
                        (sender as LookUpEdit).Refresh();
                        e.Handled = true;
                    }
                }
            }
        }
Exemplo n.º 24
0
        private void LookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            Console.WriteLine("LookUpEdit1_ProcessNewValue: {0}", e.DisplayValue);

            DataRow Row;
            RepositoryItemLookUpEdit Edit;

            Edit = ((LookUpEdit)sender).Properties;

            if (e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
            {
                return;
            }


            if ((int)RadioGroup1.EditValue == 1)
            {
                // solution 1
                Row         = LookupTable.NewRow();
                Row["Name"] = e.DisplayValue;
                LookupTable.Rows.Add(Row);
            }
            else
            {
                // solution 2
                using (Form2 f = new Form2()) {
                    f.ItemID   = "(Auto Number)";
                    f.ItemName = e.DisplayValue.ToString();
                    if (f.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        e.DisplayValue = f.ItemName;
                        Row            = LookupTable.NewRow();
                        Row["Name"]    = f.ItemName;
                        LookupTable.Rows.Add(Row);
                    }
                }
            }
            e.Handled = true;
        }
Exemplo n.º 25
0
        private void lueLyDoVe_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            string lydotxt = lookupEdit_BanCo_GiamSatXe_Reason.Text.Trim();

            if (lydotxt.Length > 0)
            {
                foreach (DataRow r in lydo.Rows)
                {
                    if (lydotxt.Equals(r["TenLyDo"]))
                    {
                        return;
                    }
                }
                try
                {
                    //Show dialog confirm
                    if (new Taxi.MessageBox.MessageBoxBA().Show("Bạn có muốn thêm mới lý do không?", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.YesNoCancel, Taxi.MessageBox.MessageBoxIconBA.Question) == Taxi.MessageBox.MessageBoxResult.Yes)
                    {
                        int ID = new StatusManagement().InsertLyDo(lookupEdit_BanCo_GiamSatXe_Reason.Text, StringTools.GetFirstsCharOfAString(lookupEdit_BanCo_GiamSatXe_Reason.Text), Taxi.Utils.Enum_ReasonType.LyDoBaoVe, 0);
                        //check ID đã insert thành công
                        if (ID <= 0)
                        {
                            return;
                        }
                        //
                        DataRow row = lydo.NewRow();
                        row["TenLyDo"] = e.DisplayValue;
                        row["id"]      = ID;
                        (lookupEdit_BanCo_GiamSatXe_Reason.Properties.DataSource as DataTable).Rows.Add(row);
                        lookupEdit_BanCo_GiamSatXe_Reason.EditValue = ID;
                        e.Handled = true;
                    }
                }
                catch
                {
                    new Taxi.MessageBox.MessageBoxBA().Show("Đã xảy ra lỗi trong quá trình thêm mới lý do", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                }
            }
        }
        private void GridLookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            //Add new values to GridLookUpEdit control's DataSource.
            GridLookUpEdit gridLookup = sender as GridLookUpEdit;

            if (e.DisplayValue == null)
            {
                return;
            }
            string newValue = e.DisplayValue.ToString();

            if (newValue == String.Empty)
            {
                return;
            }
            if (MessageBox.Show(this, "Add '" + newValue + "' to list?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                List <Product> ds = gridLookup.Properties.DataSource as List <Product>;
                ds.Add(new Product {
                    ProductName = newValue
                });
                e.Handled = true;
            }
        }
Exemplo n.º 27
0
 private void listBills_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     txtBarcode.SelectAll();
     txtBarcode.Focus();
 }
Exemplo n.º 28
0
 private void LookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     Console.WriteLine(e.DisplayValue);
 }
Exemplo n.º 29
0
 /// <summary>
 /// 处理输入的不存在领料项目号。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void lueReceiveItemNo_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     this.lueReceiveItemNo.EditValue = null;
     e.Handled = true;
 }
Exemplo n.º 30
0
 /// <summary>
 /// 处理输入的不存在工单号。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cbOrderNumber_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
 {
     this.cbOrderNumber.EditValue = null;
     e.Handled = true;
 }