コード例 #1
0
 public List <TimeZoneTrans> GetTimeZoneTransRecord(int recordID, string userid)
 {
     try
     {
         List <TimeZoneTrans> listTimeZoneTrans         = new List <TimeZoneTrans>();
         TimeZoneTrans        ConsolidatorBranchContact = new TimeZoneTrans();
         SqlParameter[]       Parameters = { new SqlParameter("@SNo", recordID) };
         DataSet ds = SqlHelper.ExecuteDataset(ReadConnectionString.WebConfigConnectionString, CommandType.StoredProcedure, "GetTimeZoneTransRecord", Parameters);
         if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
         {
             foreach (DataRow dr in ds.Tables[0].Rows)
             {
                 listTimeZoneTrans.Add(new TimeZoneTrans
                 {
                     SNo = Convert.ToInt32(dr["SNo"]),
                     //   Prefix = dr["Prefix"].ToString(),
                     //   Text_Prefix = dr["PrefixName"].ToString(),
                     //     Hour = int.Parse(dr["Hour"].ToString()),
                     Minute    = int.Parse(dr["Minute"].ToString()),
                     ValidFrom = DateTime.Parse(dr["ValidFrom"].ToString()).ToString("dd-MMM-yyyy HH:mm", CultureInfo.InvariantCulture),
                     ValidTo   = DateTime.Parse(dr["ValidTo"].ToString()).ToString("dd-MMM-yyyy HH:mm", CultureInfo.InvariantCulture),
                 }
                                       );
             }
         }
         return(listTimeZoneTrans);
     }
     catch (Exception ex)//
     {
         throw ex;
     }
 }
コード例 #2
0
        /// <summary>
        /// Retrieve Open Door  infromation from database
        /// </summary>
        /// <param name="recordID">Record id according to which touple is to be retrieved</param>
        /// <param name="page">page is the page number</param>
        /// <param name="pageSize">pageSize is the per page record</param>
        /// <param name="whereCondition">Where Condition according to which touple is to be retrieved</param>
        /// <param name="sort">Order by</param>
        /// <returns>total rows and record</returns>
        public KeyValuePair <string, List <TimeZoneTrans> > GetTimeZoneTransRecordViewUpdate(string recordID, int page, int pageSize, string whereCondition, string sort)
        {
            try
            {
                List <TimeZoneTrans> listTimeZoneTrans         = new List <TimeZoneTrans>();
                TimeZoneTrans        ConsolidatorBranchContact = new TimeZoneTrans();
                SqlParameter[]       Parameters = { new SqlParameter("@SNo", recordID) };
                DataSet ds = SqlHelper.ExecuteDataset(DMLConnectionString.WebConfigConnectionString, CommandType.StoredProcedure, "GetTimeZoneTransRecord", Parameters);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        listTimeZoneTrans.Add(new TimeZoneTrans
                        {
                            SNo = Convert.ToInt32(dr["SNo"]),
                            //   Prefix = dr["Prefix"].ToString(),
                            //   Text_Prefix = dr["PrefixName"].ToString(),
                            //     Hour = int.Parse(dr["Hour"].ToString()),
                            Minute        = int.Parse(dr["Minute"].ToString()),
                            ValidFrom     = DateTime.Parse(dr["ValidFrom"].ToString()).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
                            ValidTo       = DateTime.Parse(dr["ValidTo"].ToString()).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
                            ValidFromTime = DateTime.Parse(dr["ValidFrom"].ToString()).ToString("HH:mm:ss", CultureInfo.InvariantCulture),
                            ValidToTime   = DateTime.Parse(dr["ValidTo"].ToString()).ToString("HH:mm:ss", CultureInfo.InvariantCulture),
                        }
                                              );
                    }
                }

                return(new KeyValuePair <string, List <TimeZoneTrans> >(ds.Tables[1].Rows[0][0].ToString(), listTimeZoneTrans.AsQueryable().ToList()));
            }
            catch (Exception ex)//
            {
                throw ex;
            }
        }