Esempio n. 1
0
 /// <summary>
 /// 新增信息
 /// </summary>
 /// <param name="_PBPOSEntity"></param>
 /// <returns>返回string "-1"所属部门的岗位的名称已经存在,否则新增成功 </returns>
 public string AddPBPOS(PBPOSEntity _PBPOSEntity)
 {
     //判断该记录是否已经存在
     //判断该岗位名称是否已经存在
     DbParameter[] prams = {
                               MakeInParam("@PBPOSPN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPN),
                               MakeInParam("@PBDUTDC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBDUTDC ),
                               MakeInParam("@PBPOTTC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOTTC ),
                              };
     string sql = "select * from [PBPOS] where  PBPOSPN=@PBPOSPN and PBDUTDC=@PBDUTDC and PBPOTTC=@PBPOTTC";
     if (ExecuteDataset(CommandType.Text, sql, prams).Tables[0].Rows.Count > 0)
     {
         return "-1";//该记录已经存在
     }
     else
     {
         _PBPOSEntity.PBPOSPC = px_Sequence("PBPOSCODE", "1");
         DbParameter[] pramsInsert = {
                                 MakeInParam("@PBPOSPC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPC ),
                                 MakeInParam("@PBPOSPN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPN ),
                                 MakeInParam("@PBPOSPEN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPEN ),
                                 MakeInParam("@PBPOSPTWN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPTWN ),
                                 MakeInParam("@PBPOSBD",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSBD ),
                                 MakeInParam("@PBPOSPD",(DbType)SqlDbType.VarChar,200,_PBPOSEntity.PBPOSPD ),
                                 MakeInParam("@PBPOSRB",(DbType)SqlDbType.VarChar,100,_PBPOSEntity.PBPOSRB ),
                                 MakeInParam("@PBPOSRBN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSRBN ),
                                 MakeInParam("@PBPOSUS",(DbType)SqlDbType.Char,1,_PBPOSEntity.PBPOSUS ),
                                 MakeInParam("@PBPOSOI",(DbType)SqlDbType.Int,4,_PBPOSEntity.PBPOSOI ),
                                 MakeInParam("@PBPOTTC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOTTC ),
                                 MakeInParam("@PBDUTDC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBDUTDC ),
                                 MakeInParam("@PBPOCCC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOCCC ),
                                 MakeInParam("@PBPOSWP",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSWP ),
                                 MakeInParam("@PBPOSET",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSET ),
                                      };
         StringBuilder sb = new StringBuilder();
         sb.Append("INSERT INTO [dbo].[PBPOS]");
         sb.Append("(");
         sb.Append("[PBPOSPC]");
         sb.Append(",[PBPOSPN]");
         sb.Append(",[PBPOSPEN]");
         sb.Append(",[PBPOSPTWN]");
         sb.Append(",[PBPOSBD]");
         sb.Append(",[PBPOSPD]");
         sb.Append(",[PBPOSRB]");
         sb.Append(",[PBPOSRBN]");
         sb.Append(",[PBPOSUS]");
         sb.Append(",[PBPOSOI]");
         sb.Append(",[PBPOTTC]");
         sb.Append(",[PBDUTDC]");
         sb.Append(",[PBPOCCC]");
         sb.Append(",[PBPOSWP]");
         sb.Append(",[PBPOSET]");
         sb.Append(") ");
         sb.Append(" VALUES (");
         sb.Append("@PBPOSPC,");
         sb.Append("@PBPOSPN,");
         sb.Append("@PBPOSPEN,");
         sb.Append("@PBPOSPTWN,");
         sb.Append("@PBPOSBD,");
         sb.Append("@PBPOSPD,");
         sb.Append("@PBPOSRB,");
         sb.Append("@PBPOSRBN,");
         sb.Append("@PBPOSUS,");
         sb.Append("@PBPOSOI,");
         sb.Append("@PBPOTTC,");
         sb.Append("@PBDUTDC,");
         sb.Append("@PBPOCCC,");
         sb.Append("@PBPOSWP,");
         sb.Append("@PBPOSET )");
         sb.Append(" select @PBPOSPC;");
         return ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 修改岗位信息
        /// </summary>
        /// <param name="_PBPOSEntity"></param>
        /// <returns>返回string "0"表示全部修改成功,否则返回第一个已经存在工种名称</returns>
        public string UpDatePBPOS(PBPOSEntity[] _PBPOSEntity)
        {
            for (int i = 0; i < _PBPOSEntity.Length; i++)
            {
                string upDateResult = UpDatePBPOS(_PBPOSEntity[i]);
                if (upDateResult == "-1")
                {
                    return _PBPOSEntity[i].PBPOSPN;
                }

            }
            return "0";
        }
Esempio n. 3
0
 private PBPOSEntity GetPBPOSFromIDataReader(DbDataReader dr)
 {
     PBPOSEntity dt = new PBPOSEntity();
     if (dr.FieldCount > 0)
     {
         dt.PBPOSPC = dr["PBPOSPC"].ToString();
         dt.PBPOSPN = dr["PBPOSPN"].ToString();
         dt.PBPOSPEN = dr["PBPOSPEN"].ToString();
         dt.PBPOSPTWN = dr["PBPOSPTWN"].ToString();
         dt.PBPOSBD = dr["PBPOSBD"].ToString();
         dt.PBPOSPD = dr["PBPOSPD"].ToString();
         dt.PBPOSRB = dr["PBPOSRB"].ToString();
         dt.PBPOSRBN = dr["PBPOSRBN"].ToString();
         dt.PBPOSUS = dr["PBPOSUS"].ToString();
         dt.PBPOTTC = dr["PBPOTTC"].ToString();
         dt.PBDUTDC = dr["PBDUTDC"].ToString();
         dt.PBPOCCC = dr["PBPOCCC"].ToString();
         dt.PBPOSWP = dr["PBPOSWP"].ToString();
         dt.PBPOSET = dr["PBPOSET"].ToString();
         if (dr["PBPOSOI"].ToString() != "" || dr["PBPOSOI"] != null) dt.PBPOSOI = Int32.Parse(dr["PBPOSOI"].ToString());
         dr.Close();
         return dt;
     }
     dr.Close();
     return null;
 }
Esempio n. 4
0
        /// <summary>
        /// 修改岗位信息
        /// </summary>
        /// <param name="_PBPOSEntity"></param>
        /// <returns>返回string "-1"表示所属部门下的岗位名称已经存在</returns>
        public string UpDatePBPOS(PBPOSEntity _PBPOSEntity)
        {
            if (!_PBPOSEntity.PBPOSUS.Equals("1"))
            {
                string sqlCount = "select count(*) from PEEBI where PEEBIES != '02' and PEEBIPC = '" + _PBPOSEntity.PBPOSPC + "'";
                if (Convert.ToInt32(ExecuteScalar(CommandType.Text, sqlCount)) > 0)
                {
                    return "-2";
                }
            }
            DbParameter[] prams = {
                                      MakeInParam("@PBPOSPN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPN ),
                                      MakeInParam("@PBPOSPC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPC ),
                                      MakeInParam("@PBPOTTC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOTTC ),
                                      MakeInParam("@PBDUTDC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBDUTDC ),
                                  };
            string sql = "select * from [PBPOS] where PBPOSPN = @PBPOSPN and PBDUTDC=@PBDUTDC and PBPOTTC=@PBPOTTC and PBPOSPC<>@PBPOSPC";
            if (ExecuteDataset(CommandType.Text, sql, prams).Tables[0].Rows.Count > 0)
            {
                return "-1";//该名称已经存在
            }
            else
            {
                DbParameter[] pramsUpDate = {
                                        MakeInParam("@PBPOSPC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPC ),
                                        MakeInParam("@PBPOSPN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPN ),
                                        MakeInParam("@PBPOSPEN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPEN ),
                                        MakeInParam("@PBPOSPTWN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSPTWN ),
                                        MakeInParam("@PBPOSBD",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSBD ),
                                        MakeInParam("@PBPOSPD",(DbType)SqlDbType.VarChar,200,_PBPOSEntity.PBPOSPD ),
                                        MakeInParam("@PBPOSRB",(DbType)SqlDbType.VarChar,100,_PBPOSEntity.PBPOSRB ),
                                        MakeInParam("@PBPOSRBN",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSRBN ),
                                        MakeInParam("@PBPOSUS",(DbType)SqlDbType.Char,1,_PBPOSEntity.PBPOSUS ),
                                        MakeInParam("@PBPOSOI",(DbType)SqlDbType.Int,4,_PBPOSEntity.PBPOSOI ),
                                        MakeInParam("@PBPOTTC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOTTC ),
                                        MakeInParam("@PBDUTDC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBDUTDC ),
                                        MakeInParam("@PBPOCCC",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOCCC ),
                                        MakeInParam("@PBPOSWP",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSWP ),
                                        MakeInParam("@PBPOSET",(DbType)SqlDbType.VarChar,50,_PBPOSEntity.PBPOSET ),
                                            };

                StringBuilder sb = new StringBuilder();
                sb.Append("UpDate [dbo].[PBPOS]");
                sb.Append(" set ");
                sb.Append(" [PBPOSPN]=@PBPOSPN,");
                sb.Append(" [PBPOSPEN]=@PBPOSPEN,");
                sb.Append(" [PBPOSPTWN]=@PBPOSPTWN,");
                sb.Append(" [PBPOSBD]=@PBPOSBD,");
                sb.Append(" [PBPOSPD]=@PBPOSPD,");
                sb.Append(" [PBPOSRB]=@PBPOSRB,");
                sb.Append(" [PBPOSRBN]=@PBPOSRBN,");
                sb.Append(" [PBPOSUS]=@PBPOSUS,");
                sb.Append(" [PBPOSOI]=@PBPOSOI,");
                sb.Append(" [PBPOTTC]=@PBPOTTC,");
                sb.Append(" [PBDUTDC]=@PBDUTDC,");
                sb.Append(" [PBPOCCC]=@PBPOCCC,");
                sb.Append(" [PBPOSWP]=@PBPOSWP,");
                sb.Append(" [PBPOSET]=@PBPOSET");
                sb.Append(" where [PBPOSPC]=@PBPOSPC ");
                sb.Append(" select @PBPOSPC;");

                return ExecuteScalar(CommandType.Text, sb.ToString(), pramsUpDate).ToString();
            }
        }