Exemple #1
0
 public cArticle(SqlString artName, SqlString artField, SqlString artMag, SqlDateTime artDate)
 {
     strName = artName;
     strField = artField;
     strMagazine = artMag;
     dtmDate = artDate;
 }
Exemple #2
0
    private void getAgentsByCash()
    {
        DataTable      dtAgents = new DataTable();
        SqlDataAdapter daAgents = new SqlDataAdapter();
        SqlCommand     cmd      = new SqlCommand();
        String         agentid  = ddlAgents.SelectedValue;

        if (!String.IsNullOrEmpty(txt_fromDate.Text.ToString()) && !String.IsNullOrEmpty(txt_toDate.Text.ToString()))
        {
            DateTime ff = DateTime.ParseExact(txt_fromDate.Text, "dd/MM/yyyy", null);
            System.Data.SqlTypes.SqlDateTime dtSql = System.Data.SqlTypes.SqlDateTime.Parse(ff.ToString("yyyy-MM-dd"));
            from = dtSql.ToString();
            from = txt_fromDate.Text.ToString();
            to   = txt_toDate.Text.ToString();
        }

        try
        {
            cmd.Connection = con;
            con.Open();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "getAgentsByCash";
            cmd.Parameters.AddWithValue("@from", from);
            cmd.Parameters.AddWithValue("@to", to);
            cmd.Parameters.AddWithValue("@agentid", agentid);

            daAgents = new SqlDataAdapter(cmd);
            daAgents.Fill(dtAgents);
            if (dtAgents != null)
            {
                if (dtAgents.Rows.Count > 0)
                {
                    Session["dtProduct"] = dtAgents;
                    repAgents.DataSource = dtAgents;
                    repAgents.DataBind();
                    btnExcelExport.Visible = true;
                }
                else
                {
                    repAgents.DataSource = null;
                    repAgents.DataBind();
                    btnExcelExport.Visible = false;
                }
            }
            else
            {
                repAgents.DataSource = null;
                repAgents.DataBind();
                btnExcelExport.Visible = false;
            }
        }
        catch (Exception ex)
        {
            ErrHandler.writeError(ex.Message, ex.StackTrace);
        }
        finally
        {
            con.Close();
        }
    }
        /// <summary>
        /// full constructor 
        /// </summary>
        ///
        public TabRescenCourseInfo(String FCourseId_0, String FCourseName_1,
				String FCourseNo_2, String FParentId_3, Int32 FSortCode_4,
				String FCoursePath_5, String FCoursetypeId_6, Int32 FCourseformatId_7,
				String FSupplierId_8, String FSysuserId_9, SqlDateTime FCreateTime_10,
				String FTecherName_11, String FLevelId_12, Int32 FChapterNums_13,
				Int32 FCourseScores_14, Int32 FCourseHours_15, Double FStudyDuration_16,
				Double FCoursePrice_17, String FCourseDesc_18, Int32 FVerifyStatus_19,
				Int32 FUseStatus_20, Int32 FIsSell_21)
        {
            this.FCourseId = FCourseId_0;
            this.FCourseName = FCourseName_1;
            this.FCourseNo = FCourseNo_2;
            this.FParentId = FParentId_3;
            this.FSortCode = FSortCode_4;
            this.FCoursePath = FCoursePath_5;
            this.FCoursetypeId = FCoursetypeId_6;
            this.FCourseformatId = FCourseformatId_7;
            this.FSupplierId = FSupplierId_8;
            this.FSysuserId = FSysuserId_9;
            this.FCreateTime = FCreateTime_10;
            this.FTecherName = FTecherName_11;
            this.FLevelId = FLevelId_12;
            this.FChapterNums = FChapterNums_13;
            this.FCourseScores = FCourseScores_14;
            this.FCourseHours = FCourseHours_15;
            this.FStudyDuration = FStudyDuration_16;
            this.FCoursePrice = FCoursePrice_17;
            this.FCourseDesc = FCourseDesc_18;
            this.FVerifyStatus = FVerifyStatus_19;
            this.FUseStatus = FUseStatus_20;
            this.FIsSell = FIsSell_21;
        }
Exemple #4
0
    public static SqlDateTime LocalizeDT(SqlDateTime dt)
    {
        if (dt.IsNull)
               return new SqlDateTime();

          return new SqlDateTime(dt.Value.ToLocalTime());
    }
                public void GetReady() 
		{
            Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "en-US";
			Test1 = new SqlDateTime (2002, 10, 19, 9, 40, 0);
			Test2 = new SqlDateTime (2003, 11, 20,10, 50, 1);
			Test3 = new SqlDateTime (2003, 11, 20, 10, 50, 1);
		}
 public static SqlDateTime ParamDateTimeTemp(SqlXml Xml, SqlString Name)
 {
     String ValueType;
       String Value = GetValueFromXMLAttribute(Xml, Name, out ValueType);
       if (Value == null) return new SqlDateTime();
       SqlDateTime Result;
       try
       {
     Result = new SqlDateTime(XmlConvert.ToDateTime(Value, XmlDateTimeSerializationMode.RoundtripKind));
       }
       catch (Exception Error)
       {
     throw new System.Exception("Error convert Param = \"" + Name.Value.ToString() + "\" Value = \"" + Value.ToString() + "\" to DateTime: " + Error.Message);
       }
       if (ValueType != null && ValueType != "")
       {
     // year, month, day, hour, minute, second
     switch (ValueType)
     {
       case "1": return Result.Value.Date.AddDays(1);
       default: return Result;
     }
       }
       return Result;
 }
Exemple #7
0
 public SqlDateTimeTest()
 {
     CultureInfo.CurrentCulture = new CultureInfo("en-US");
     _test1 = new SqlDateTime(2002, 10, 19, 9, 40, 0);
     _test2 = new SqlDateTime(2003, 11, 20, 10, 50, 1);
     _test3 = new SqlDateTime(2003, 11, 20, 10, 50, 1);
 }
        public string GetGroupChangeInformationBetweenDates(SqlDateTime begin, SqlDateTime end)
        {
            string blank = "";
            Collection<RequestForm> forms = GetApprovedRequestsBetweenDates(begin, end);
            List<string> groups = _dataRequest.GetAllGroups();
            Dictionary<string, int> groupCount = new Dictionary<string, int>();

            foreach (string entry in groups)
            {
                groupCount.Add(entry, 0);
            }

            foreach (RequestForm entry in forms)
            {
                if (entry != null)
                {
                    string pastGroup = entry.Current.BazookaInfo.Group;
                    string futureGroup = entry.Future.BazookaInfo.Group;
                    if (groupCount.ContainsKey(pastGroup))
                        groupCount[pastGroup]--;

                    if (groupCount.ContainsKey(futureGroup))
                        groupCount[futureGroup]++;
                }
            }

            foreach (string entry in groups)
            {
                if (groupCount[entry] != 0)
                    blank += String.Format("Group {0} changed by {1} people\n", entry, groupCount[entry]);
            }

            return blank;
        }
 public static object Box(SqlDateTime a)
 {
     if (a.IsNull)
         return null;
     else
         return a.Value;
 }
    public static void spGetNewVestaErrands(SqlDateTime date)
    {
        DateTime d = date.Value;

        String reqStr = String.Format("http://{0}/services/internalSite/errands/sendNewVestaErrandsMails?date={1}",
                                                                                                                                UserDefinedFunctions.fGetWapServerName(), d.ToString("s"));
        SqlContext.Pipe.Send(reqStr);
        HttpWebRequest rq = (HttpWebRequest)WebRequest.Create(reqStr);
        rq.KeepAlive = false;
        XmlDocument xdoc = new XmlDocument();
        using(HttpWebResponse rs = (HttpWebResponse)rq.GetResponse())
        using(Stream stream = rs.GetResponseStream())
                xdoc.Load(stream);
        XmlNode root = xdoc["result"];

        SqlDataRecord rec = new SqlDataRecord(new SqlMetaData("id", SqlDbType.NVarChar, -1),
                                                                                                                                                                new SqlMetaData("text", SqlDbType.NVarChar, -1),
                                                                                                                                                                new SqlMetaData("creator", SqlDbType.NVarChar, -1),
                                                                                                                                                                new SqlMetaData("email", SqlDbType.NVarChar, -1)
                                                                                                                                                            );
        SqlContext.Pipe.SendResultsStart(rec);
        foreach(XmlNode ch in root.ChildNodes)
        {
            rec.SetValues(ch["id"].InnerText,
                                                                    ch["text"].InnerText,
                                                                    ch["creator"].InnerText,
                                                                    ch["email"].InnerText
                                                                    );
            SqlContext.Pipe.SendResultsRow(rec);
        }
        SqlContext.Pipe.SendResultsEnd();
    }
Exemple #11
0
                public void GetReady() 
		{
			Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");
			Test1 = new SqlDateTime (2002, 10, 19, 9, 40, 0);
			Test2 = new SqlDateTime (2003, 11, 20,10, 50, 1);
			Test3 = new SqlDateTime (2003, 11, 20, 10, 50, 1);
		}
Exemple #12
0
        public static void AddContainerACL(
            SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
            SqlString containerName,
            SqlString containerPublicReadAccess,
            SqlString accessPolicyId,
            SqlDateTime start, SqlDateTime expiry,
            SqlBoolean canRead,
            SqlBoolean canWrite,
            SqlBoolean canDeleteBlobs,
            SqlBoolean canListBlobs,
            SqlGuid LeaseId,
            SqlInt32 timeoutSeconds,
            SqlGuid xmsclientrequestId)
        {
            Enumerations.ContainerPublicReadAccess cpraNew;
            if(!Enum.TryParse<Enumerations.ContainerPublicReadAccess>(containerPublicReadAccess.Value, out cpraNew))
            {
                StringBuilder sb = new StringBuilder("\"" + containerPublicReadAccess.Value + "\" is an invalid ContainerPublicReadAccess value. Valid values are: ");
                foreach (string s in Enum.GetNames(typeof(Enumerations.ContainerPublicReadAccess)))
                    sb.Append("\"" + s + "\" ");
                throw new ArgumentException(sb.ToString());
            }

            AzureBlobService abs = new AzureBlobService(accountName.Value, sharedKey.Value, useHTTPS.Value);
            Container cont = abs.GetContainer(containerName.Value);

            Enumerations.ContainerPublicReadAccess cpra;
            SharedAccessSignature.SharedAccessSignatureACL sasACL = cont.GetACL(out cpra,
                LeaseId.IsNull ? (Guid?)null : LeaseId.Value,
                timeoutSeconds.IsNull ? 0 : timeoutSeconds.Value,
                xmsclientrequestId.IsNull ? (Guid?)null : xmsclientrequestId.Value);

            string strPermissions = "";
            if (canRead.IsTrue)
                strPermissions += "r";
            if (canWrite.IsTrue)
                strPermissions += "w";
            if (canDeleteBlobs.IsTrue)
                strPermissions += "d";
            if (canListBlobs.IsTrue)
                strPermissions += "l";

            SharedAccessSignature.AccessPolicy ap = new SharedAccessSignature.AccessPolicy()
            {
                Start = start.Value,
                Expiry = expiry.Value,
                Permission = strPermissions
            };

            sasACL.SignedIdentifier.Add(new SharedAccessSignature.SignedIdentifier()
                {
                    AccessPolicy = ap,
                    Id = accessPolicyId.Value
                });

            cont.UpdateContainerACL(cpraNew, sasACL,
                LeaseId.IsNull ? (Guid?)null : LeaseId.Value,
                timeoutSeconds.IsNull ? 0 : timeoutSeconds.Value,
                xmsclientrequestId.IsNull ? (Guid?)null : xmsclientrequestId.Value);
        }
 public SqlDateTime(int year, int month, int day, int hour, int minute, int second, double millisecond)
 {
     if (((year >= MinYear) && (year <= MaxYear)) && ((month >= 1) && (month <= 12)))
     {
         int[] numArray = IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365;
         if ((day >= 1) && (day <= (numArray[month] - numArray[month - 1])))
         {
             int num2 = year - 1;
             int dayTicks = ((((((num2 * 0x16d) + (num2 / 4)) - (num2 / 100)) + (num2 / 400)) + numArray[month - 1]) + day) - 1;
             dayTicks -= DayBase;
             if (((((dayTicks >= MinDay) && (dayTicks <= MaxDay)) && ((hour >= 0) && (hour < 0x18))) && (((minute >= 0) && (minute < 60)) && ((second >= 0) && (second < 60)))) && ((millisecond >= 0.0) && (millisecond < 1000.0)))
             {
                 double num4 = (millisecond * SQLTicksPerMillisecond) + 0.5;
                 int timeTicks = (((hour * SQLTicksPerHour) + (minute * SQLTicksPerMinute)) + (second * SQLTicksPerSecond)) + ((int) num4);
                 if (timeTicks > MaxTime)
                 {
                     timeTicks = 0;
                     dayTicks++;
                 }
                 this = new SqlDateTime(dayTicks, timeTicks);
                 return;
             }
         }
     }
     throw new SqlTypeException(SQLResource.InvalidDateTimeMessage);
 }
Exemple #14
0
    public static SqlDouble HR_TimeLogs_TimeSpan(SqlDateTime startAt, SqlDateTime endAt)
    {
        if (endAt.IsNull || startAt.IsNull)
               return new SqlDouble();

          TimeSpan duration = endAt.Value.Subtract(startAt.Value);
          return new SqlDouble(duration.TotalSeconds);
    }
 public static SqlInt32 DayOfWeek(SqlDateTime time) {
     if (time.IsNull) return SqlInt32.Null;
     var numb = (int) time.Value.DayOfWeek;
     if(numb==0) {
         numb = 7;
     }
     return numb;
 }
Exemple #16
0
 public static void FillRow(Object obj, out SqlDateTime timeWritten, out SqlChars message, out SqlChars category, out long instanceId)
 {
     EventLogEntry eventLogEntry = (EventLogEntry)obj;
     timeWritten = new SqlDateTime(eventLogEntry.TimeWritten);
     message = new SqlChars(eventLogEntry.Message);
     category = new SqlChars(eventLogEntry.Category);
     instanceId = eventLogEntry.InstanceId;
 }
Exemple #17
0
    public static SqlDateTime YearMonth(SqlDateTime dt)
    {
        if (dt.IsNull)
               return new SqlDateTime();

          System.DateTime moment = dt.Value.ToLocalTime();
          return new SqlDateTime(moment.Year, moment.Month, 1); //.ToString("yyyy-M"));
    }
 internal SqlPersistenceWorkflowInstanceDescription(Guid workflowInstanceId, WorkflowStatus status, bool isBlocked, string suspendOrTerminateDescription, SqlDateTime nextTimerExpiration)
 {
     this.workflowInstanceId = workflowInstanceId;
     this.status = status;
     this.isBlocked = isBlocked;
     this.suspendOrTerminateDescription = suspendOrTerminateDescription;
     this.nextTimerExpiration = nextTimerExpiration;
 }
Exemple #19
0
    public static SqlInt32 FN_GER_GetWeekOfYear(SqlDateTime _date)
    {

        System.Globalization.GregorianCalendar gc = new System.Globalization.GregorianCalendar();


        return _date.IsNull ? SqlInt32.Null : gc.GetWeekOfYear(_date.Value, System.Globalization.CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday);
    }
    public static SqlDateTime ConvertToUTC(SqlDateTime SourceDateTime, SqlString SourceTimeZone)
    {
        if (SourceDateTime.IsNull)
          return SqlDateTime.Null;

        Zone  tzSource      = Database.GetZone(SourceTimeZone.Value);

        return tzSource.ConvertToUtc(SourceDateTime.Value);
    }
    public static SqlDateTime ConvertFromUTC(SqlDateTime SourceDateTime, SqlString DestinationTimeZone)
    {
        if (SourceDateTime.IsNull)
          return SqlDateTime.Null;

        Zone  tzDestination = Database.GetZone(DestinationTimeZone.Value);

        return tzDestination.ConvertToLocal(SourceDateTime.Value);
    }
 public static SqlDateTime ToWeekStart(SqlDateTime time)
 {
     if (time.IsNull) return SqlDateTime.Null;
     var day = (int) time.Value.DayOfWeek;
     if (day == 0) day = 7;
     day = day - 1;
     var result = time.Value.AddDays(-day);
     return new DateTime(result.Year, result.Month, result.Day);
 }
    public static SqlDateTime ToWeekEnd(SqlDateTime time)
    {
        if (time.IsNull) return SqlDateTime.Null;
        var day = (int)time.Value.DayOfWeek;
        if (day == 0) day = 7;
        day = 7 - day;
        var result = time.Value.AddDays(day);
        return new DateTime(result.Year, result.Month, result.Day).AddDays(1).AddMilliseconds(-100);

    }
Exemple #24
0
 public static void LockEnlistRow(object obj, out SqlString code, out SqlString handler, out SqlDateTime time) {
     var pair = (KeyValuePair<string, LockRecord>) obj;
     code = pair.Key;
     if (pair.Value != null) {
         handler = pair.Value.Identity;
         time = pair.Value.Time;
     }else {
         handler = SqlString.Null;
         time = SqlDateTime.Null;
     }
 }
        public static void CreateActivity(SqlString url, SqlString username, SqlString password, SqlString token, SqlDateTime createdDT, SqlBoolean externalMessage, SqlString employeeId, SqlString actUrl, SqlString actTitle, SqlString actBody)
        {
            IChatterSoapService service = new ChatterSoapService(url.Value);
            service.AllowUntrustedConnection();
            service.Login(username.Value, password.Value, token.Value);

            service.CreateProfileActivity(employeeId.IsNull ? null : employeeId.Value, actUrl.IsNull ? null : actUrl.Value, actTitle.IsNull ? null : actTitle.Value, actBody.IsNull ? null : actBody.Value, createdDT.Value);
            if (externalMessage.IsTrue)
            {
                service.CreateExternalMessage(actUrl.IsNull ? null : actUrl.Value, actTitle.IsNull ? null : actTitle.Value, actBody.IsNull ? null : actBody.Value, employeeId.IsNull ? null : employeeId.Value);
            }
        }
    public static SqlDateTime CombineDateTime(SqlDateTime dateComponent, SqlDateTime timeComponent)
    {
        if (dateComponent.IsNull) return SqlDateTime.Null;

        var date = dateComponent.Value;

        if (!timeComponent.IsNull)
        {
            date = date.Add(timeComponent.Value.TimeOfDay);
        }

        return new SqlDateTime(date);
    }
Exemple #27
0
    public static void Refunds_FillRow(object tableObject, out SqlInt64 RefundID, out SqlDateTime CreatedAt, out SqlString Note, out SqlBoolean Restock, out SqlInt64 UserID,
        out SqlInt32 RefundLineItems, out SqlInt32 Transactions)
    {
        Refund r = (Refund)tableObject;
        RefundID = r.id;
        CreatedAt = r.created_at != null ? Convert.ToDateTime(r.created_at) : SqlDateTime.Null;
        Note = r.note != null ? r.note.ToString() : SqlString.Null;
        Restock = Convert.ToBoolean(r.restock);
        UserID = r.user_id;

        RefundLineItems = r.refund_line_items.Count;
        Transactions = r.transactions.Count;
    }
Exemple #28
0
        public void Create()
        {
            // SqlDateTime (DateTime)
            SqlDateTime CTest = new SqlDateTime(
                new DateTime(2002, 5, 19, 3, 34, 0));
            Assert.Equal(2002, CTest.Value.Year);

            // SqlDateTime (int, int)
            CTest = new SqlDateTime(0, 0);

            // SqlDateTime (int, int, int)
            Assert.Equal(1900, CTest.Value.Year);
            Assert.Equal(1, CTest.Value.Month);
            Assert.Equal(1, CTest.Value.Day);
            Assert.Equal(0, CTest.Value.Hour);

            // SqlDateTime (int, int, int, int, int, int)
            CTest = new SqlDateTime(5000, 12, 31);
            Assert.Equal(5000, CTest.Value.Year);
            Assert.Equal(12, CTest.Value.Month);
            Assert.Equal(31, CTest.Value.Day);

            // SqlDateTime (int, int, int, int, int, int, double)
            CTest = new SqlDateTime(1978, 5, 19, 3, 34, 0);
            Assert.Equal(1978, CTest.Value.Year);
            Assert.Equal(5, CTest.Value.Month);
            Assert.Equal(19, CTest.Value.Day);
            Assert.Equal(3, CTest.Value.Hour);
            Assert.Equal(34, CTest.Value.Minute);
            Assert.Equal(0, CTest.Value.Second);

            try
            {
                CTest = new SqlDateTime(10000, 12, 31);
                Assert.False(true);
            }
            catch (Exception e)
            {
                Assert.Equal(typeof(SqlTypeException), e.GetType());
            }

            // SqlDateTime (int, int, int, int, int, int, int)
            CTest = new SqlDateTime(1978, 5, 19, 3, 34, 0, 12);
            Assert.Equal(1978, CTest.Value.Year);
            Assert.Equal(5, CTest.Value.Month);
            Assert.Equal(19, CTest.Value.Day);
            Assert.Equal(3, CTest.Value.Hour);
            Assert.Equal(34, CTest.Value.Minute);
            Assert.Equal(0, CTest.Value.Second);
            Assert.Equal(0, CTest.Value.Millisecond);
        }
        public static SqlDateTime BuildSqlDateTime(
            DateTime? minValue = null,
            DateTime? maxValue = null)
        {
            // SqlDateTime must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM
            var minSqlDateTime = new SqlDateTime(minValue ?? SqlDateTime.MinValue.Value);
            var maxSqlDateTime = new SqlDateTime(maxValue ?? SqlDateTime.MaxValue.Value);

            Assert.Greater(maxSqlDateTime, minSqlDateTime, 
                "TestDataHelper error: maxValue must be greater than minValue");

            var range = (maxSqlDateTime.Value - minSqlDateTime.Value).Ticks;
            return new DateTime((long)(minSqlDateTime.Value.Ticks + (Randomizer.NextDouble() * range)));
        }
Exemple #30
0
 public static void Fulfillments_FillRow(object tableObject, out SqlInt64 ID, out SqlInt64 OrderID, out SqlString Status, out SqlDateTime CreatedAt,
     out SqlString Service, out SqlDateTime UpdatedAt, out SqlString TrackingCompany, out SqlString TrackingNumber, out SqlString TrackingURL)
 {
     Fulfillment f = (Fulfillment)tableObject;
     ID = f.id;
     OrderID = f.order_id;
     Status = f.status;
     CreatedAt = f.created_at != null ? Convert.ToDateTime(f.created_at) : SqlDateTime.Null;
     Service = f.service;
     UpdatedAt = f.updated_at != null ? Convert.ToDateTime(f.updated_at) : SqlDateTime.Null;
     TrackingCompany = f.tracking_company != null ? f.tracking_company.ToString() : SqlString.Null;
     TrackingNumber = f.tracking_number;
     TrackingURL = f.tracking_url;
 }
    public static SqlInt64 FN_GER_ConvertDatetimeToTimestamp(SqlDateTime _date)
    {
        long objReturn = 0;

        if (!_date.IsNull)
        {

            DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0);

            TimeSpan elapsedTime = _date.Value.ToUniversalTime() - Epoch;
            objReturn = (long)elapsedTime.TotalSeconds;
        }
        return _date.IsNull ? SqlInt64.Null : objReturn;
    }
Exemple #32
0
    private void GetIncomeExpenseJSON()
    {
        DataTable      dtDetails           = new DataTable();
        SqlDataAdapter daIncomeExpenseJSON = new SqlDataAdapter();
        SqlCommand     cmd = new SqlCommand();

        if (!String.IsNullOrEmpty(txt_fromDate.Text.ToString()) && !String.IsNullOrEmpty(txt_toDate.Text.ToString()))
        {
            DateTime ff = DateTime.ParseExact(txt_fromDate.Text, "dd/MM/yyyy", null);
            System.Data.SqlTypes.SqlDateTime dtSql = System.Data.SqlTypes.SqlDateTime.Parse(ff.ToString("yyyy-MM-dd"));
            from = dtSql.ToString();
            from = txt_fromDate.Text.ToString();
            to   = txt_toDate.Text.ToString();

            //from = String.Format("yyyy-MM-dd", txt_fromDate.Text.ToString());
            //to = String.Format("yyyy-MM-dd", txt_toDate.Text.ToString());
        }
        //else {
        //    //from = DateTime.ParseExact("01/01/1900", "dd/MM/yyyy", null);
        //    //to = DateTime.Now;
        //    from = "1900-01-01";
        //    to = DateTime.Now.ToString("yyyy-MM-dd");
        //}
        try
        {
            cmd.Connection = con;
            con.Open();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "getIncomeExpenseDetails";
            cmd.Parameters.AddWithValue("@from", from);
            cmd.Parameters.AddWithValue("@to", to);
            daIncomeExpenseJSON = new SqlDataAdapter(cmd);
            daIncomeExpenseJSON.Fill(dtDetails);
            if (dtDetails != null)
            {
                if (dtDetails.Rows.Count > 0)
                {
                    markers = DataTableToJSONWithJavaScriptSerializerDetails(dtDetails);
                }
            }
        }
        catch (Exception ex)
        {
            ErrHandler.writeError(ex.Message, ex.StackTrace);
        }
        finally
        {
            con.Close();
        }
    }
Exemple #33
0
 // Alternative method for operator <
 public static SqlBoolean LessThan(SqlDateTime x, SqlDateTime y)
 {
     return(x < y);
 }
Exemple #34
0
 // Alternative method for operator >
 public static SqlBoolean GreaterThan(SqlDateTime x, SqlDateTime y)
 {
     return(x > y);
 }
Exemple #35
0
 // Alternative method for operator <=
 public static SqlBoolean LessThanOrEqual(SqlDateTime x, SqlDateTime y)
 {
     return(x <= y);
 }
Exemple #36
0
 // Alternative method for operator >=
 public static SqlBoolean GreaterThanOrEqual(SqlDateTime x, SqlDateTime y)
 {
     return(x >= y);
 }
Exemple #37
0
 // Alternative method for operator !=
 public static SqlBoolean NotEquals(SqlDateTime x, SqlDateTime y)
 {
     return(x != y);
 }
Exemple #38
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <returns>[To be supplied.]</returns>
        public bool Refresh()
        {
            this.displayName = null;

            this.col_Ord_DatOrderedOnWasUpdated = false;
            this.col_Ord_DatOrderedOnWasSet     = false;
            this.col_Ord_DatOrderedOn           = System.Data.SqlTypes.SqlDateTime.Null;

            this.col_Ord_LngCustomerIDWasUpdated = false;
            this.col_Ord_LngCustomerIDWasSet     = false;
            this.col_Ord_LngCustomerID           = System.Data.SqlTypes.SqlInt32.Null;

            this.col_Ord_CurTotalWasUpdated = false;
            this.col_Ord_CurTotalWasSet     = false;
            this.col_Ord_CurTotal           = System.Data.SqlTypes.SqlMoney.Null;

            bool alreadyOpened = false;

            Params.spS_tblOrder Param = new Params.spS_tblOrder(true);
            Param.CommandTimeOut = this.selectCommandTimeOut;
            switch (this.lastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                Param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                Param.SetUpConnection(this.sqlConnection);
                alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                Param.SetUpConnection(this.sqlTransaction);
                break;
            }

            if (!this.col_Ord_GuidID.IsNull)
            {
                Param.Param_Ord_GuidID = this.col_Ord_GuidID;
            }


            System.Data.SqlClient.SqlDataReader sqlDataReader = null;
            SPs.spS_tblOrder Sp = new SPs.spS_tblOrder(false);
            if (Sp.Execute(ref Param, out sqlDataReader))
            {
                if (sqlDataReader.Read())
                {
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex))
                    {
                        this.col_Ord_DatOrderedOn = sqlDataReader.GetSqlDateTime(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex))
                    {
                        this.col_Ord_LngCustomerID = sqlDataReader.GetSqlInt32(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.ColumnIndex))
                    {
                        this.col_Ord_CurTotal = sqlDataReader.GetSqlMoney(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.ColumnIndex);
                    }

                    if (sqlDataReader != null && !sqlDataReader.IsClosed)
                    {
                        sqlDataReader.Close();
                    }

                    CloseConnection(Sp.Connection, alreadyOpened);

                    this.recordIsLoaded = true;

                    return(true);
                }
                else
                {
                    if (sqlDataReader != null && !sqlDataReader.IsClosed)
                    {
                        sqlDataReader.Close();
                    }

                    CloseConnection(Sp.Connection, alreadyOpened);

                    this.recordIsLoaded = false;

                    return(false);
                }
            }
            else
            {
                if (sqlDataReader != null && !sqlDataReader.IsClosed)
                {
                    sqlDataReader.Close();
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.tblOrder_Record", "Refresh");
            }
        }
Exemple #39
0
        //--------------------------------------------------
        // Alternative methods for overloaded operators
        //--------------------------------------------------

        // Alternative method for operator +
        public static SqlDateTime Add(SqlDateTime x, TimeSpan t)
        {
            return(x + t);
        }
Exemple #40
0
 // Alternative method for operator -
 public static SqlDateTime Subtract(SqlDateTime x, TimeSpan t)
 {
     return(x - t);
 }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <returns>[To be supplied.]</returns>
        public bool Refresh()
        {
            this.displayName = null;

            this.col_DescriptionWasUpdated = false;
            this.col_DescriptionWasSet     = false;
            this.col_Description           = System.Data.SqlTypes.SqlString.Null;

            this.col_PriceWasUpdated = false;
            this.col_PriceWasSet     = false;
            this.col_Price           = System.Data.SqlTypes.SqlMoney.Null;

            this.col_StartDateWasUpdated = false;
            this.col_StartDateWasSet     = false;
            this.col_StartDate           = System.Data.SqlTypes.SqlDateTime.Null;

            this.col_EndDateWasUpdated = false;
            this.col_EndDateWasSet     = false;
            this.col_EndDate           = System.Data.SqlTypes.SqlDateTime.Null;

            this.col_CustomerIdWasUpdated = false;
            this.col_CustomerIdWasSet     = false;
            this.col_CustomerId           = System.Data.SqlTypes.SqlInt32.Null;

            bool alreadyOpened = false;

            Params.spS_Job Param = new Params.spS_Job(true);
            Param.CommandTimeOut = this.selectCommandTimeOut;
            switch (this.lastKnownConnectionType)
            {
            case Bob.DataClasses.ConnectionType.ConnectionString:
                Param.SetUpConnection(this.connectionString);
                break;

            case Bob.DataClasses.ConnectionType.SqlConnection:
                Param.SetUpConnection(this.sqlConnection);
                alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                break;

            case Bob.DataClasses.ConnectionType.SqlTransaction:
                Param.SetUpConnection(this.sqlTransaction);
                break;
            }

            if (!this.col_JobId.IsNull)
            {
                Param.Param_JobId = this.col_JobId;
            }


            System.Data.SqlClient.SqlDataReader sqlDataReader = null;
            SPs.spS_Job Sp = new SPs.spS_Job(false);
            if (Sp.Execute(ref Param, out sqlDataReader))
            {
                if (sqlDataReader.Read())
                {
                    if (!sqlDataReader.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_Description.ColumnIndex))
                    {
                        this.col_Description = sqlDataReader.GetSqlString(SPs.spS_Job.Resultset1.Fields.Column_Description.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_Price.ColumnIndex))
                    {
                        this.col_Price = sqlDataReader.GetSqlMoney(SPs.spS_Job.Resultset1.Fields.Column_Price.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_StartDate.ColumnIndex))
                    {
                        this.col_StartDate = sqlDataReader.GetSqlDateTime(SPs.spS_Job.Resultset1.Fields.Column_StartDate.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_EndDate.ColumnIndex))
                    {
                        this.col_EndDate = sqlDataReader.GetSqlDateTime(SPs.spS_Job.Resultset1.Fields.Column_EndDate.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_CustomerId.ColumnIndex))
                    {
                        this.col_CustomerId = sqlDataReader.GetSqlInt32(SPs.spS_Job.Resultset1.Fields.Column_CustomerId.ColumnIndex);
                    }

                    if (sqlDataReader != null && !sqlDataReader.IsClosed)
                    {
                        sqlDataReader.Close();
                    }

                    CloseConnection(Sp.Connection, alreadyOpened);

                    this.recordIsLoaded = true;

                    return(true);
                }
                else
                {
                    if (sqlDataReader != null && !sqlDataReader.IsClosed)
                    {
                        sqlDataReader.Close();
                    }

                    CloseConnection(Sp.Connection, alreadyOpened);

                    this.recordIsLoaded = false;

                    return(false);
                }
            }
            else
            {
                if (sqlDataReader != null && !sqlDataReader.IsClosed)
                {
                    sqlDataReader.Close();
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                throw new Bob.DataClasses.CustomException(Param, "Bob.BusinessComponents.Job_Record", "Refresh");
            }
        }
Exemple #42
0
 private static DateTime ToDateTime(SqlDateTime value)
 {
     return(s_SQLBaseDate.Add(ToTimeSpan(value)));
 }