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

            }
            return View(model);
        }
Example #2
0
        public void AddDailyCardReport(DailyCardReport model)
        {
            try
            {
                string strSQL = @"
                                if exists (select id from dailycardreport
                                            where stationid=@stationid
                                            and reportdate=@reportdate and collectionclassid=@collectionclassid)
                                begin
                                    update dailycardreport set
                                    SentCards=@SentCards,
                                    WrongCards=@WrongCards,
                                    ReceivedCards=@ReceivedCards,
                                    BrokenCards=@BrokenCards,
                                    cruser=@cruser,
                                    crtime=getdate()
                                    where stationid=@stationid
                                    and reportdate=@reportdate and collectionclassid=@collectionclassid
                                end
                                else
                                begin
                                    insert into dailycardreport(ReportDate,StationID,CollectionClassID,sentcards,wrongcards,receivedcards,brokencards,cruser)
                                        values(@ReportDate,@StationID,@CollectionClassID,@sentcards,@wrongcards,@receivedcards,@brokencards,@cruser)
                                end  ";

                SqlParameter[] parms = new SqlParameter[]{
                new SqlParameter("@CollectionClassID",SqlDbType.Int),
                new SqlParameter("@reportdate",SqlDbType.DateTime),
                new SqlParameter("@sentcards",SqlDbType.Int),
                new SqlParameter("@wrongcards",SqlDbType.Int),
                new SqlParameter("@receivedcards",SqlDbType.Int),
                new SqlParameter("@brokencards",SqlDbType.Int),
                new SqlParameter("@cruser",SqlDbType.Int),
                new SqlParameter("@stationid",SqlDbType.Int),
            };

                parms[0].Value = model.CollectionClassID;
                parms[1].Value = model.ReportDate;
                parms[2].Value = model.SentCards;
                parms[3].Value = model.WrongCards;
                parms[4].Value = model.ReceivedCards;
                parms[5].Value = model.BrokenCards;
                parms[6].Value = model.CrUser;
                parms[7].Value = model.StationID;
                SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #3
0
 public void AddDailyCardReport(DailyCardReport model)
 {
     dareport.AddDailyCardReport(model);
 }