示例#1
0
        public ActionResult ShortOver(ShortOverReport model)
        {
            if (ModelState.IsValid)
            {
                model.CrUser = CurrentUserModel.Current.UserID;
                model.StationID = CurrentUserModel.Current.StationID;
                new BLReports().AddShortOver(model);
                return Content("<script>alert('添加成功');window.location.href='/report/ShortOver';</script>");

            }
            return View(model);
        }
示例#2
0
 public void AddShortOver(ShortOverReport model)
 {
     dareport.AddShortOver(model);
 }
示例#3
0
        public void AddShortOver(ShortOverReport model)
        {
            try
            {
                string strSQL = @"
                                if exists (select id from shortoverreport
                                            where stationid=@stationid
                                            and reportdate=@reportdate)
                                begin
                                    update shortoverreport set
                                    amount=@amount,
                                    shortovertimes=@shortovertimes,
                                    chargeTimes=@chargeTimes,
                                    cruser=@cruser,
                                    crtime=getdate()
                                    where stationid=@stationid
                                    and reportdate=@reportdate
                                end
                                else
                                begin
                                    insert into shortoverreport(reportdate,amount,shortovertimes,chargeTimes,cruser,stationid)
                                        values(@reportdate,@amount,@shortovertimes,@chargeTimes,@cruser,@stationid)
                                end  ";

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

                parms[0].Value = model.ReportDate;
                parms[1].Value = model.ShortOverAmount;
                parms[2].Value = model.ShortOverTimes;
                parms[3].Value = model.ChargeTimes;
                parms[4].Value = model.CrUser;
                parms[5].Value = model.StationID;
                SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
            }
            catch (Exception ex)
            {
                throw;
            }
        }