private void btnNoMEnter_Click(object sender, EventArgs e)
        {
            try
            {
                if (!CheckData())
                {
                    return;
                }

                //修改数据
                if (_entityId != int.MaxValue)
                {
                    NoReceiveMoney noReceiveMoney = DataManager.NoReceiveMoneyBLL.GetEntityById(_entityId);
                    if (noReceiveMoney != null)
                    {
                        noReceiveMoney.CustomerName = this.txtNoM_CustomerName.Text;
                        noReceiveMoney.Phone        = this.txtNoM_Phone.Text;
                        noReceiveMoney.Remark       = this.txtNoM_Remark.Text;
                        var isSuccess = DataManager.NoReceiveMoneyBLL.Edit(noReceiveMoney);
                        if (isSuccess)
                        {
                            ClearData();
                            this.Tag = "true";//通知父窗口 ,可以关闭
                            this.Close();
                        }
                    }
                }
                //添加数据
                else if (_orderId != null)
                {
                    NoReceiveMoney noReceiveMoney = new NoReceiveMoney();
                    noReceiveMoney.OrderId      = _orderId;
                    noReceiveMoney.CustomerName = this.txtNoM_CustomerName.Text.Trim();
                    noReceiveMoney.Phone        = this.txtNoM_Phone.Text.Trim();
                    noReceiveMoney.WaitPayPrice = Convert.ToDecimal(this.txtNoM_Money.Text.Trim());
                    noReceiveMoney.CreateTime   = DateTime.Now;
                    noReceiveMoney.Remark       = this.txtNoM_Remark.Text;
                    var isSuccess = DataManager.NoReceiveMoneyBLL.Add(noReceiveMoney);
                    if (isSuccess)
                    {
                        ClearData();
                        this.Tag = "true";//通知父窗口 ,可以关闭
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("操作失败");
                    this.Tag = "false";//通知父窗口 ,不可以关闭
                }
            }
            catch (Exception)
            {
                MessageBox.Show("操作失败,请检查信息是否正确!!");
                return;
            }
        }
        public static Frm_NoReceiveMoney Create(int entityId = int.MaxValue)
        {
            //修改
            if (entityId != int.MaxValue)
            {
                _entityId = entityId;
                NoReceiveMoney noReceiveMoney = DataManager.NoReceiveMoneyBLL.GetEntityById(entityId);
                _orderId = noReceiveMoney.OrderId;
            }

            if (_form == null)
            {
                _form = new Frm_NoReceiveMoney();
            }

            return(_form);
        }
        static void EditNoReceiveMoney()
        {
            NoReceiveMoneyDal noReceiveMoneyDal = new NoReceiveMoneyDal();

            NoReceiveMoney noReceiveMoney = new NoReceiveMoney();

            noReceiveMoney.Id           = 1;
            noReceiveMoney.CustomerName = "fdf";
            bool d = noReceiveMoneyDal.Edit(noReceiveMoney);

            if (d)
            {
                Console.WriteLine("成功");
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
        static void AddNoReceiveMoney()
        {
            NoReceiveMoneyDal noReceiveMoneyDal = new NoReceiveMoneyDal();
            ProfitsInfoDal    salesInfoDal      = new ProfitsInfoDal();
            NoReceiveMoney    noReceiveMoney    = new NoReceiveMoney();

            noReceiveMoney.SalesInfoId  = 2;
            noReceiveMoney.SalesInfo    = salesInfoDal.GetEntityById(2);
            noReceiveMoney.CustomerName = "hhh";
            noReceiveMoney.CreateTime   = DateTime.Now;
            noReceiveMoney.Phone        = "15779708285";
            bool d = noReceiveMoneyDal.Add(noReceiveMoney);

            if (d)
            {
                Console.WriteLine("成功");
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
 public void Init()
 {
     if (_entityId != int.MaxValue)
     {
         NoReceiveMoney noReceiveMoney = DataManager.NoReceiveMoneyBLL.GetEntityById(_entityId);
         if (noReceiveMoney != null)
         {
             this.txtNoM_OrderId.Text      = noReceiveMoney.OrderId;
             this.txtNoM_CustomerName.Text = noReceiveMoney.CustomerName;
             this.txtNoM_Phone.Text        = noReceiveMoney.Phone;
             this.txtNoM_Remark.Text       = noReceiveMoney.Remark;
             this.txtNoM_Money.Text        = noReceiveMoney.WaitPayPrice.ToString();
         }
     }
     else if (_orderId != null)
     {
         this.txtNoM_OrderId.Text = _orderId;
         this.txtNoM_Money.Text   = _waitPayPrice;
     }
     else
     {
         MessageBox.Show("发生意外情况,请联系开发人员");
     }
 }
Exemple #6
0
        /// <summary>
        /// 获取默认的表名
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name">表名</param>
        /// <param name="handText">列名</param>
        /// <param name="hideIndex">隐藏列</param>
        public static void GetHandTxtAndHideIndex(int id, ref List <string> name, ref List <string> handText, ref List <int> hideIndex)
        {
            switch (id)
            {
            case 0:
                name      = new GoodsInfo().GetTableName();
                handText  = new GoodsInfo().GetHanderTxt();
                hideIndex = new GoodsInfo().GetHideIndex();
                break;

            case 1:
                name      = new OrderInfo().GetTableName();
                handText  = new OrderInfo().GetHanderTxt();
                hideIndex = new OrderInfo().GetHideIndex();
                break;

            case 2:
                name      = new GoodsInfo().GetTableName();
                handText  = new GoodsInfo().GetHanderTxt();
                hideIndex = new GoodsInfo().GetHideIndex();
                break;

            case 3:
                name      = new OrderInfo().GetTableName();
                handText  = new OrderInfo().GetHanderTxt();
                hideIndex = new OrderInfo().GetHideIndex();
                break;

            case 4:
                name      = new ProfitsInfo().GetTableName();
                handText  = new ProfitsInfo().GetHanderTxt();
                hideIndex = new ProfitsInfo().GetHideIndex();
                break;

            case 5:
                name      = new NoReceiveMoney().GetTableName();
                handText  = new NoReceiveMoney().GetHanderTxt();
                hideIndex = new NoReceiveMoney().GetHideIndex();
                break;

            case 6:
                name      = new UnitInfo().GetTableName();
                handText  = new UnitInfo().GetHanderTxt();
                hideIndex = new UnitInfo().GetHideIndex();
                break;

            case 7:
                name      = new SortInfo().GetTableName();
                handText  = new SortInfo().GetHanderTxt();
                hideIndex = new SortInfo().GetHideIndex();
                break;

            case 8:
                name      = new WholeSalerInfo().GetTableName();
                handText  = new WholeSalerInfo().GetHanderTxt();
                hideIndex = new WholeSalerInfo().GetHideIndex();
                break;

            case 9:
                name      = new UserInfo().GetTableName();
                handText  = new UserInfo().GetHanderTxt();
                hideIndex = new UserInfo().GetHideIndex();
                break;

            default:
                break;
            }
        }