コード例 #1
0
ファイル: ReportController.cs プロジェクト: tianyawang/Report
        public ActionResult DailyAmountReport(DailyAmountReport model)
        {
            if (ModelState.IsValid)
            {
                model.CrUser = CurrentUserModel.Current.UserID;
                model.StationID = CurrentUserModel.Current.StationID;
                new BLReports().AddDailyAmountReport(model);
                return Content("<script>alert('添加成功');window.location.href='/report/DailyAmountReport';</script>");

            }
            return View(model);
        }
コード例 #2
0
ファイル: DAReports.cs プロジェクト: tianyawang/Report
        public void AddDailyAmountReport(DailyAmountReport model)
        {
            try
            {
                string strSQL = @"
                                if exists (select id from dailyamountreport
                                            where stationid=@stationid
                                            and reportdate=@reportdate and schedue=@schedue)
                                begin
                                    update dailyamountreport set
                                    amount=@amount,
                                    easyaccessamount=@easyaccessamount,
                                    cruser=@cruser,
                                    crtime=getdate()
                                    where stationid=@stationid
                                    and reportdate=@reportdate and schedue=@schedue
                                end
                                else
                                begin
                                    insert into dailyamountreport(schedue,reportdate,amount,easyaccessamount,cruser,stationid)
                                        values(@schedue,@reportdate,@amount,@easyaccessamount,@cruser,@stationid)
                                end  ";

                SqlParameter[] parms = new SqlParameter[]{
                new SqlParameter("@schedue",SqlDbType.Int),
                new SqlParameter("@reportdate",SqlDbType.DateTime),
                new SqlParameter("@amount",SqlDbType.Decimal),
                new SqlParameter("@easyaccessamount",SqlDbType.Decimal),
                new SqlParameter("@cruser",SqlDbType.Int),
                new SqlParameter("@stationid",SqlDbType.Int),
            };

                parms[0].Value = model.Schedue;
                parms[1].Value = model.ReportDate;
                parms[2].Value = model.Amount;
                parms[3].Value = model.EasyAccessAmount;
                parms[4].Value = model.CrUser;
                parms[5].Value = model.StationID;
                SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #3
0
ファイル: BLReports.cs プロジェクト: tianyawang/Report
 public void AddDailyAmountReport(DailyAmountReport model)
 {
     dareport.AddDailyAmountReport(model);
 }