示例#1
0
        /// <summary>
        /// 上传测酒记录
        /// </summary>
        public InterfaceOutPut AddDrinkInfo(String Data)
        {
            InterfaceOutPut output = new InterfaceOutPut();

            output.result = 1;
            try
            {
                InAddDrinkInfo InParams = JsonConvert.DeserializeObject <InAddDrinkInfo>(Data);
                DBBianXie      db       = new DBBianXie();

                //职位信息----- 开始----------
                DBDrinkLogic dbdl = new DBDrinkLogic();
                MDDrinkLogic mddl = new MDDrinkLogic();
                MDDrinkLogic mdl  = new MDDrinkLogic();
                mddl = dbdl.GetDrinkCadreEntity(InParams.drinkInfo.strTrainmanNumber);
                if (mddl != null)
                {
                    InParams.drinkInfo.strDepartmentID   = mddl.strDepartmentID;
                    InParams.drinkInfo.strDepartmentName = mddl.strDepartmentName;
                    InParams.drinkInfo.nCadreTypeID      = mddl.nCadreTypeID;
                    InParams.drinkInfo.strCadreTypeName  = mddl.strCadreTypeName;
                }
                else
                {
                    InParams.drinkInfo.strDepartmentID   = "";
                    InParams.drinkInfo.strDepartmentName = "";
                    InParams.drinkInfo.nCadreTypeID      = "";
                    InParams.drinkInfo.strCadreTypeName  = "";
                }
                //职位信息----- 结束----------

                if (InParams.drinkInfo.strTrainmanNumber.Trim() != "" && InParams.drinkInfo.dtCreateTime.ToString() != "")
                {
                    if (db.IsExit(InParams.drinkInfo.dtCreateTime.ToString(), InParams.drinkInfo.strTrainmanNumber.Trim()))
                    {
                        return(new InterfaceOutPut());
                    }
                }


                if (InParams.drinkInfo.strTrainmanGUID.Trim() == "")
                {
                    InParams.drinkInfo.strTrainmanGUID = db.GetTrainmanGUIDByNumber(InParams.drinkInfo.strTrainmanNumber);
                }

                db.AddDrinkInfo(InParams.drinkInfo);
                output.result = 0;
            }
            catch (Exception ex)
            {
                output.resultStr = ex.Message;
                throw ex;
            }
            return(output);
        }
示例#2
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
        }