Ejemplo n.º 1
0
        public string UpDateCalendar(MyCalendar _MyCalendar)
        {
            DbParameter[] pramsUpDate = {
                                           MakeInParam("@ID",(DbType)SqlDbType.Int,4,_MyCalendar.ID),
                                           MakeInParam("@UID",(DbType)SqlDbType.VarChar,50,_MyCalendar.UID),
                                           MakeInParam("@EID",(DbType)SqlDbType.VarChar,50,_MyCalendar.EID),
                                           MakeInParam("@EName",(DbType)SqlDbType.VarChar,50,_MyCalendar.EName),
                                           MakeInParam("@STime",(DbType)SqlDbType.VarChar,50,_MyCalendar.STime),
                                           MakeInParam("@ETime",(DbType)SqlDbType.VarChar,50,_MyCalendar.ETime),
                                           MakeInParam("@CTime",(DbType)SqlDbType.VarChar,50,_MyCalendar.CTime),
                                           MakeInParam("@MEMO",(DbType)SqlDbType.VarChar,50,_MyCalendar.MEMO),
                                             };

            StringBuilder sb = new StringBuilder();
            sb.Append("UpDate [dbo].[Calendar]");
            sb.Append(" set ");
            sb.Append(" [ID]=@ID,");
            sb.Append(" [UID]=@UID,");
            sb.Append(" [EID]=@EID,");
            sb.Append(" [EName]=@EName,");
            sb.Append(" [STime]=@STime,");
            sb.Append(" [ETime]=@ETime,");
            sb.Append(" [CTime]=@CTime,");
            sb.Append(" [MEMO]=@MEMO");
            sb.Append(" where [UID]=@UID  and [EID]=@EID");
            sb.Append(" select @ID ");
            return ExecuteScalar(CommandType.Text, sb.ToString(), pramsUpDate).ToString();
        }
Ejemplo n.º 2
0
 private MyCalendar GetCalendarFromIDataReader(DbDataReader dr)
 {
     MyCalendar dt = new MyCalendar();
     if (dr.FieldCount > 0)
     {
         dt.CTime = dr["CTime"].ToString();
         dt.EID = dr["EID"].ToString();
         dt.EName = dr["EName"].ToString();
         dt.ETime = dr["ETime"].ToString();
         dt.ID = Int32.Parse(dr["ID"].ToString());
         dt.MEMO = dr["MEMO"].ToString();
         dt.STime = dr["STime"].ToString();
         dt.UID = dr["UID"].ToString();
         dr.Close();
         return dt;
     }
     dr.Close();
     return null;
 }
Ejemplo n.º 3
0
        public string AddNewsCalender(MyCalendar _MyCalendar)
        {
            DbParameter[] pramsInsert = {

                                           MakeInParam("@ID",(DbType)SqlDbType.Int,4,_MyCalendar.ID),
                                           MakeInParam("@UID",(DbType)SqlDbType.VarChar,50,_MyCalendar.UID),
                                           MakeInParam("@EID",(DbType)SqlDbType.VarChar,50,_MyCalendar.EID),
                                           MakeInParam("@EName",(DbType)SqlDbType.VarChar,50,_MyCalendar.EName),
                                           MakeInParam("@STime",(DbType)SqlDbType.VarChar,50,_MyCalendar.STime),
                                           MakeInParam("@ETime",(DbType)SqlDbType.VarChar,50,_MyCalendar.ETime),
                                           MakeInParam("@CTime",(DbType)SqlDbType.VarChar,50,_MyCalendar.CTime),
                                           MakeInParam("@MEMO",(DbType)SqlDbType.VarChar,50,_MyCalendar.MEMO),
                                             };
            StringBuilder sb = new StringBuilder();
            sb.Append("INSERT INTO [dbo].[Calendar]");
            sb.Append("([ID]");
            sb.Append(",[UID]");
            sb.Append(",[EID]");
            sb.Append(",[EName]");
            sb.Append(",[STime]");
            sb.Append(",[ETime]");
            sb.Append(",[CTime]");
            sb.Append(",[MEMO]");
            sb.Append(")");
            sb.Append("VALUES");
            sb.Append("(@ID");
            sb.Append(",@UID");
            sb.Append(",@EID");
            sb.Append(",@EName");
            sb.Append(",@STime");
            sb.Append(",@ETime");
            sb.Append(",@CTime");
            sb.Append(",@MEMO");
            sb.Append(")");
            sb.Append(" select @ID;");

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