Beispiel #1
0
        private SqlParameter para; //参数

        public int AddItemConsume(ItemConsumeBean b)
        {
            int count = 0;

            try
            {
                SqlParameter[] sp =
                {
                    para = new SqlParameter("@OrderFlowSerial", b.ItemReserve.Order.FlowSerial),
                    para = new SqlParameter("@LessonId",        b.ItemReserve.Lesson.Id),
                    para = new SqlParameter("@ItemTotal",       b.ItemReserve.Count),
                    para = new SqlParameter("@ConsumeCount",    b.ConsumeCount),
                    para = new SqlParameter("@RemainCount",     b.RemainCount),
                    para = new SqlParameter("@CustomerId",      b.Consumer.Id),
                    para = new SqlParameter("@TeacherId",       b.Teacher.Id),
                    para = new SqlParameter("@OperatorId",      b.Oper.Id),
                    para = new SqlParameter("@Remark",          b.Remark),
                };
                count = sh.RunSql("PR_ItemConsume_Add", sp);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(count);
        }
        private void SaveConsume()
        {
            ItemConsumeDAO  d = new ItemConsumeDAO();
            ItemConsumeBean b = new ItemConsumeBean();

            b.Consumer.Id = customerId;

            foreach (DataRow r in tabSelect.Rows)
            {
                b.ItemReserve.Order.FlowSerial = r["FlowSerial"].ToString();
                b.ItemReserve.Lesson.Id        = Convert.ToInt32(r["LessonId"].ToString());
                b.Consumer.Id  = customerId;
                b.RemainCount  = Convert.ToInt32(r["Remain"].ToString());
                b.ConsumeCount = Convert.ToInt32(r["CurrentConsume"].ToString());
                b.Teacher.Id   = Convert.ToInt32(r["TeacherId"].ToString());
                b.Oper.Id      = Program.loginUser.Id;
                b.Remark       = "";

                d.AddItemConsume(b);
            }
        }