Ejemplo n.º 1
0
        public static void Fp_dzd_DoubleClick(object sender, EventArgs e)
        {
            if (sender is MyTextBox)
            {
                MyTextBox box_dzd = sender as MyTextBox;
                if (box_dzd.SelectedDataValue == null)
                {
                    ArchiveDetailForm form  = box_dzd.FindForm() as ArchiveDetailForm;
                    decimal           money = Convert.ToDecimal(((form.DisplayManager.DataControls["金额"] as IWindowControl).Control as MyCurrencyTextBox).SelectedDataValue);
                    string            xgr   = ((form.DisplayManager.DataControls["相关人编号"] as IWindowControl).Control as MyComboBox).SelectedDataValue.ToString();

                    using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <对账单>())
                    {
                        IList <对账单> list = (rep as Feng.NH.INHibernateRepository).List <对账单>(NHibernate.Criterion.DetachedCriteria.For <对账单>()
                                                                                             .Add(NHibernate.Criterion.Expression.Eq("金额", money))
                                                                                             .Add(NHibernate.Criterion.Expression.Eq("相关人编号", xgr))
                                                                                             .AddOrder(NHibernate.Criterion.Order.Desc("关账日期")).SetMaxResults(1));

                        if (list == null || list.Count == 0)
                        {
                            MessageForm.ShowWarning("找不到有效的对账单!");
                            return;
                        }

                        box_dzd.SelectedDataValue = list[0].编号;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static void Ck_货代自编号_DoubleClick(object sender, EventArgs e)
        {
            if (sender is MyTextBox)
            {
                MyTextBox box_hdzbh = sender as MyTextBox;
                if (box_hdzbh.SelectedDataValue == null)
                {
                    ArchiveDetailForm form = box_hdzbh.FindForm() as ArchiveDetailForm;

                    if (((form.DisplayManager.DataControls["委托人编号"] as IWindowControl).Control as MyComboBox).SelectedDataValue == null ||
                        ((form.DisplayManager.DataControls["委托时间"] as IWindowControl).Control as MyDatePicker).SelectedDataValue == null)
                    {
                        return;
                    }

                    string   wtr  = ((form.DisplayManager.DataControls["委托人编号"] as IWindowControl).Control as MyComboBox).SelectedDataValue.ToString();
                    DateTime wtsj = DateTime.Parse(((form.DisplayManager.DataControls["委托时间"] as IWindowControl).Control as MyDatePicker).SelectedDataValue.ToString());

                    box_hdzbh.SelectedDataValue = Get货代自编号(wtr, wtsj, GetSimpleParamValue(form.GridName + "_货代自编号"));
                }
            }
        }