public InterfaceResult SubmitDrinkRec(string input)
        {
            input = HttpUtility.UrlDecode(input);
            InterfaceResult jsonModel = new InterfaceResult();

            try
            {
                SubmitDrinkRec paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <SubmitDrinkRec>(input);

                DBSiteLogic dbSiteLogic = new DBSiteLogic();

                dbSiteLogic.SubmitDrinkRecord(paramModel);

                jsonModel.result    = 0;
                jsonModel.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                TF.CommonUtility.LogClass.logex(ex, "");
                jsonModel.result    = 1;
                jsonModel.resultStr = "提交测酒事件失败" + ex.InnerException.Message.ToString();
            }
            return(jsonModel);
        }
Beispiel #2
0
        public void SubmitDrinkRecord(SubmitDrinkRec Rec)
        {
            SqlTrans sqlTrans = new SqlTrans();

            sqlTrans.Begin();
            try
            {
                if (Rec.workid != string.Empty)
                {
                    string sql = @"select top 1 * from TAB_Plan_RunEvent_SiteInOut where 
                strInRoomSourceID1 = @workid or 
                strInRoomSourceID2= @workid or 
                strOutRoomSourceID1 = @workid or 
                strOutRoomSourceID2 = @workid";


                    SqlParameter[] sqlparam =
                    {
                        new SqlParameter("@workid", Rec.workid)
                    };

                    DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, sql, sqlparam).Tables[0];



                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        if (dr["strInRoomSourceID1"].ToString() == Rec.workid)
                        {
                            sql = @"Update TAB_Plan_RunEvent_SiteInOut set strInBrief1 = @DrinResult where strTrainPlanGUID = @workid";
                        }
                        else
                        if (dr["strInRoomSourceID2"].ToString() == Rec.workid)
                        {
                            sql = @"Update TAB_Plan_RunEvent_SiteInOut set strInBrief2 = @DrinResult where strTrainPlanGUID = @workid";
                        }
                        else
                        if (dr["strOutRoomSourceID1"].ToString() == Rec.workid)
                        {
                            sql = @"Update TAB_Plan_RunEvent_SiteInOut set strOutBrief1 = @DrinResult where strTrainPlanGUID = @workid";
                        }
                        else
                        if (dr["strOutRoomSourceID2"].ToString() == Rec.workid)
                        {
                            sql = @"Update TAB_Plan_RunEvent_SiteInOut set strOutBrief2 = @DrinResult where strTrainPlanGUID = @workid";
                        }



                        SqlParameter[] uparams =
                        {
                            new SqlParameter("@workid",     Rec.workid),
                            new SqlParameter("@DrinResult", Rec.ToResultString())
                        };

                        SqlHelper.ExecuteNonQuery(sqlTrans.trans, CommandType.Text, sql, uparams);
                    }
                }

                DBDrink.InsertDrinkRecord(Rec, sqlTrans.trans);
                sqlTrans.Commit();
            }
            catch (Exception ex)
            {
                sqlTrans.RollBack();
                throw ex;
            }
        }
Beispiel #3
0
        public static void InsertDrinkRecord(SubmitDrinkRec Rec, SqlTransaction trans)
        {
            string placeName = DBDictionary.GetDutyPlaceID(Rec.stmis);

            Trainman trainman = new Trainman();

            DBDictionary.GetTrainman(Rec.tmid, trainman);


            #region 添加测酒记录
            MDDrink MDDr = new MDDrink();
            TF.Runsafty.Plan.DB.DBDrink DBDr = new Runsafty.Plan.DB.DBDrink();
            //职位信息----- 开始----------
            DBDrinkLogic dbdl = new DBDrinkLogic();
            MDDrinkLogic mddl = new MDDrinkLogic();
            mddl = dbdl.GetDrinkCadreEntity(Rec.tmid);
            if (mddl != null)
            {
                MDDr.strDepartmentID   = mddl.strDepartmentID;
                MDDr.strDepartmentName = mddl.strDepartmentName;
                MDDr.nCadreTypeID      = mddl.nCadreTypeID;
                MDDr.strCadreTypeName  = mddl.strCadreTypeName;
            }
            //职位信息----- 结束----------

            //是否是本段
            MDDr.nLocalAreaTrainman = 0;
            MDDr.trainmanID         = trainman.tmGUID;
            MDDr.createTime         = DateTime.Now.ToString();
            MDDr.verifyID           = 0;
            MDDr.oPlaceId           = "";
            MDDr.strGuid            = Guid.NewGuid().ToString();
            MDDr.drinkResult        = Rec.nresult.ToString();
            MDDr.strAreaGUID        = "";
            MDDr.dutyUserID         = "";
            MDDr.strTrainmanName    = trainman.tmname;
            MDDr.strTrainmanNumber  = Rec.tmid;
            MDDr.strTrainNo         = "";
            MDDr.strTrainNumber     = "";
            MDDr.strTrainTypeName   = "";
            MDDr.strWorkShopGUID    = trainman.workShopID;
            MDDr.strWorkShopName    = trainman.workShopName;
            MDDr.strPlaceID         = Rec.stmis;
            MDDr.strPlaceName       = placeName;
            MDDr.strSiteGUID        = "";
            MDDr.strSiteName        = "";
            MDDr.dwAlcoholicity     = "";
            MDDr.strWorkID          = "";
            MDDr.nWorkTypeID        = Rec.workType;//工作类型为退勤
            MDDr.imagePath          = CreateImgPath(Rec);
            SqlTrans sqltrans = new SqlTrans();
            sqltrans.Begin();
            try
            {
                DBDr.SubmitDrink(MDDr, sqltrans.trans);
                sqltrans.Commit();
            }
            catch (Exception ex)
            {
                sqltrans.RollBack();
                throw ex;
            }
            #endregion
        }
Beispiel #4
0
 private static string CreateImgPath(SubmitDrinkRec Rec)
 {
     return("/DrinkImage/" +
            Rec.etime.Year.ToString() + "/" + Rec.etime.Month.ToString() + "/" +
            Rec.etime.Day.ToString() + "/" + Rec.testid + ".jpg");
 }