Ejemplo n.º 1
0
        private void btnOrderEnter_Click(object sender, EventArgs e)
        {
            Huang_System f1 = (Huang_System)this.Owner;//将本窗体的拥有者强制设为Form1类的实例f

            try
            {
                var orderInfo = f1.OrdersInfo[orderIndex];
                theGoodInfo = DataManager.GoodsInfoBLL.GetEntityById(orderInfo.GoodsId);
                double count, disCount;
                count                     = double.Parse(txtOrder_Count.Text.Trim());
                disCount                  = double.Parse(txtOrder_DisCount.Text.Trim());
                orderInfo.Count           = count;
                orderInfo.DisCount        = (decimal)disCount;
                orderInfo.PayPrice        = theGoodInfo.PayPrice * (decimal)count - (decimal)disCount;
                orderInfo.Profit          = (orderInfo.PayPrice) - (theGoodInfo.PurPrice * (decimal)count);//利润;
                orderInfo.Remark          = this.txtOrder_Remark.Text.ToString();
                f1.OrdersInfo[orderIndex] = orderInfo;
                this.Close();
            }
            catch
            {
                MessageBox.Show("发生未知错误!!!");
                this.Close();
            }
        }
        private void btnEnter_Click(object sender, EventArgs e)
        {
            Huang_System f1 = (Huang_System)this.Owner;//本窗体的拥有者强制设为Form1类的实例


            var dic = Setting.SettingToDic();

            Common.XMLHelper.WriteXML(dic);
            this.Close();
        }
Ejemplo n.º 3
0
        private void btnOrderOK_Click(object sender, EventArgs e)
        {
            ///操作步骤: 1获取订单表数据 ,将订单表数据添加数据库
            ///2计算 利润 ,将得出利润数据 利润表添加数据
            ///3 客户是否付款登记,如未登记 则进行 客户待回收账登记
            ///4 商品库存管理
            ///关闭窗口.

            Huang_System f1 = (Huang_System)this.Owner;//将本窗体的拥有者强制设为Form1类的实例
            //获取订单表
            var OrdersInfo = f1.OrdersInfo;

            decimal allProfit   = (decimal)0;
            decimal allDisCount = (decimal)0;
            string  orderId     = OrdersInfo[0].OrderId;//个数保证大于0;

            for (int i = 0; i < OrdersInfo.Count; i++)
            {
                //下订单
                var goodsInfo    = DataManager.GoodsInfoBLL.GetEntityById(OrdersInfo[i].GoodsId);
                var salesCount   = goodsInfo.SalesCount + OrdersInfo[i].Count;   //卖出数量
                var surplusCount = goodsInfo.SurplusCount - OrdersInfo[i].Count; //剩余数量
                var isSucess     = DataManager.OrderInfoBLL.Add(OrdersInfo[i]);
                if (!isSucess)
                {
                    MessageBox.Show("下订单失败,请重试,如多次失败请联系管理员");
                    return;
                }
                //改库存
                var editSucess = DataManager.GoodsInfoBLL.EditGoodsInfoCount(goodsInfo.Id, salesCount, surplusCount);
                if (!editSucess)
                {
                    MessageBox.Show("修改失败,请重试,如多次失败请联系管理员");
                    return;
                }

                allProfit   += OrdersInfo[i].Profit;   //利润
                allDisCount += OrdersInfo[i].DisCount; //折扣
            }
            //利润信息表
            ProfitsInfo profitsInfo = new ProfitsInfo();

            profitsInfo.OrderId    = orderId;
            profitsInfo.CreateTime = DateTime.Now;
            profitsInfo.Profit     = allProfit;
            profitsInfo.DisCount   = allDisCount;
            profitsInfo.PayPrices  = decimal.Parse(_payPrice);
            profitsInfo.IsPay      = false;                  //默认为未收款
            f1.TempProfit          = profitsInfo;            //下单完成则利润表完成
            f1.OrdersInfo          = new List <OrderInfo>(); //清空订单表
            this.Close();
        }
Ejemplo n.º 4
0
        private void btnRemoveOrder_Click(object sender, EventArgs e)
        {
            Huang_System f1 = (Huang_System)this.Owner;//将本窗体的拥有者强制设为Form1类的实例f

            try
            {
                f1.OrdersInfo.RemoveAt(orderIndex);
                this.Close();
            }
            catch
            {
                MessageBox.Show("出错了,请重试");
            }
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var userName = txtName.Text.Trim();
            var userpwd  = txtPwd.Text.Trim();
            var isTure   = DataManager.UserInfoBLL.IsTrueNameAndPwd(userName, userpwd, out int id);

            if (isTure)
            {
                this.Hide();//隐藏当前
                Huang_System huang_System = new Huang_System(id);
                huang_System.ShowDialog();
            }
            else
            {
                lblTips.Visible = true;
            }
        }
        private void btnEnter_Click(object sender, EventArgs e)
        {
            Huang_System f1 = (Huang_System)this.Owner;//将本窗体的拥有者强制设为Form1类的实例f

            if (!CheckInput())
            {
                lbltips.Text      = "请检查数据,(*)数据不能为空";
                lbltips.ForeColor = Color.Red;
                return;
            }
            //添加时候 默认 id 为maxValue
            if (entityId == int.MaxValue)
            {
                WholeSalerInfo wholeSalerInfo = new WholeSalerInfo();
                wholeSalerInfo.SupName     = txtSupName.Text.Trim();
                wholeSalerInfo.Management  = txtManagement.Text.Trim();
                wholeSalerInfo.TelePhone   = txtPhone.Text.Trim();
                wholeSalerInfo.AddressInfo = txtAddress.Text.Trim();
                wholeSalerInfo.Remark      = txtRemark.Text.Trim();
                var isSuccess = DataManager.WholeSalerInfoBLL.Add(wholeSalerInfo);
                if (!isSuccess)
                {
                    MessageBox.Show("操作失败!");
                }
                this.Tag = true;
                this.Close();
            }
            else
            {
                WholeSalerInfo wholeSalerInfo = new WholeSalerInfo();
                wholeSalerInfo.SupName     = txtSupName.Text.Trim();
                wholeSalerInfo.Management  = txtManagement.Text.Trim();
                wholeSalerInfo.TelePhone   = txtPhone.Text.Trim();
                wholeSalerInfo.AddressInfo = txtAddress.Text.Trim();
                wholeSalerInfo.Remark      = txtRemark.Text.Trim();
                wholeSalerInfo.Id          = entityId;
                var isSuccess = DataManager.WholeSalerInfoBLL.Edit(wholeSalerInfo);
                if (!isSuccess)
                {
                    MessageBox.Show("操作失败!");
                }
                this.Close();
            }
            //属性界面
            f1.GetDgv(f1.SelectIndex);
        }
Ejemplo n.º 7
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            Huang_System f1 = (Huang_System)this.Owner;//将本窗体的拥有者强制设为Form1类的实例f

            if (txtFirst.Text == "")
            {
                lbltips.Text      = "请检查数据,数据不能为空";
                lbltips.ForeColor = Color.Red;
                return;
            }
            //添加时候 默认 id 为maxValue
            if (entityId == int.MaxValue)
            {
                //添加

                UnitInfo unitInfo = new UnitInfo();
                unitInfo.UnitName = txtFirst.Text.Trim();
                unitInfo.Remark   = txtRmark.Text.Trim().Replace(';', '.'); //替换';'
                //后期 英文";"有作用
                var isSuccess = DataManager.UnitInfoBLL.Add(unitInfo);
                if (!isSuccess)
                {
                    MessageBox.Show("操作失败!");
                }
                this.Tag             = true;
                this.lbltips.Visible = false;
                this.lbltips.Text    = "";
                this.Close();
            }
            else
            {
                UnitInfo unitInfo = new UnitInfo();
                unitInfo.UnitName = txtFirst.Text.Trim();
                unitInfo.Remark   = txtRmark.Text.Trim();
                unitInfo.Id       = entityId;
                var isSuccess = DataManager.UnitInfoBLL.Edit(unitInfo);
                if (!isSuccess)
                {
                    MessageBox.Show("操作失败!");
                }
                this.Close();
            }
            //属性界面
            f1.GetDgv(f1.SelectIndex);
        }
Ejemplo n.º 8
0
        public void  InIt()
        {
            Huang_System f1 = (Huang_System)this.Owner;//将本窗体的拥有者强制设为Form1类的实例f

            try
            {
                var orderInfo = f1.OrdersInfo[orderIndex];
                theGoodInfo             = DataManager.GoodsInfoBLL.GetEntityById(orderInfo.GoodsId);
                maxCount                = theGoodInfo.SurplusCount;
                txtOrder_GoodsName.Text = orderInfo.GoodsName;
                txtOrder_Count.Text     = orderInfo.Count.ToString();
                txtOrder_DisCount.Text  = orderInfo.DisCount.ToString();
                double dfd = (double)orderInfo.PayPrice;
                txtOrder_Price.Text  = orderInfo.PayPrice.ToString();
                txtOrder_Remark.Text = orderInfo.Remark;
                this.lblTips.Visible = false;
            }
            catch
            {
                MessageBox.Show("发生未知错误!!!");
                this.Close();
            }
        }
Ejemplo n.º 9
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            Huang_System f1 = (Huang_System)this.Owner;//将本窗体的拥有者强制设为Form1类的实例f

            if (!CheckInput())
            {
                return;
            }
            //添加时候 默认 id 为maxValue
            if (entityId == int.MaxValue)
            {
                //添加
                var name = txtUserName.Text.Trim();
                if (!IsContainsSpital(name))
                {
                    lbltips.Visible   = true;
                    lbltips.ForeColor = Color.Red;
                    lbltips.Text      = "用户名不能使用特殊字符";
                    return;
                }
                var isExist = DataManager.UserInfoBLL.IsExistName(name);
                if (!isExist)
                {
                    UserInfo userInfo = new UserInfo();
                    userInfo.UserName = txtUserName.Text.Trim();
                    userInfo.PassWord = Md5Helper.EncryptString(txtPwd.Text.Trim());
                    userInfo.Remark   = txtRmark.Text.Trim();
                    var isSuccess = DataManager.UserInfoBLL.Add(userInfo);
                    if (!isSuccess)
                    {
                        MessageBox.Show("操作失败!");
                        return;
                    }
                    else
                    {
                        this.lbltips.Visible = false;
                        this.lbltips.Text    = "";
                        this.Close();
                    }
                }
                else
                {
                    lbltips.Visible   = true;
                    lbltips.ForeColor = Color.Red;
                    lbltips.Text      = "存在相同用户名,请更换用户名";
                }
            }
            else
            {
                UserInfo userInfo = new UserInfo();
                var      name     = txtUserName.Text.Trim();
                //检查名称是否含有特殊字符
                if (!IsContainsSpital(name))
                {
                    lbltips.Visible   = true;
                    lbltips.ForeColor = Color.Red;
                    lbltips.Text      = "用户名不能使用特殊字符,修改失败";
                    return;
                }
                //检查修改后名称是否符合要求
                var isExist = DataManager.UserInfoBLL.IsExistName(name);
                if (isExist)
                {
                    lbltips.Visible   = true;
                    lbltips.ForeColor = Color.Red;
                    lbltips.Text      = "存在相同用户名,请更换用户名";
                    return;
                }
                userInfo.UserName = name;
                if (txtPwd.Text.Trim() != "123456789")
                {
                    userInfo.PassWord = Md5Helper.EncryptString(txtPwd.Text.Trim());
                }
                userInfo.Remark = txtRmark.Text.Trim();
                userInfo.Id     = entityId;
                var isSuccess = DataManager.UserInfoBLL.Edit(userInfo);
                if (!isSuccess)
                {
                    MessageBox.Show("操作失败!");
                    return;
                }
                this.Close();
            }
            //属性界面
            f1.GetDgv(f1.SelectIndex);
        }