protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { foreach (DateTime date in LoadClass.GetDistinctDates()) { ListItem itemYear = new ListItem(); itemYear.Text = date.Year.ToString(); itemYear.Value = date.Year.ToString(); if (!SelectYear.Items.Contains(itemYear)) { SelectYear.Items.Add(itemYear); } // select just the current year months if (date.Year == DateTime.Now.Year) { ListItem itemMonth = new ListItem(); itemMonth.Text = date.Month.ToString(); itemMonth.Value = date.Month.ToString(); if (!SelectMonth.Items.Contains(itemMonth)) { SelectMonth.Items.Add(itemMonth); } } } ((Button)((Site)Master).BtnSearchLoads).BackColor = System.Drawing.Color.White; ((Button)((Site)Master).BtnSearchLoads).ForeColor = System.Drawing.Color.Black; GridViewDayLoads.DataSource = LoadClass.GetAllLoads(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day)); GridViewDayLoads.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ((Button)((Site)Master).BtnOldLoad).BackColor = System.Drawing.Color.White; ((Button)((Site)Master).BtnOldLoad).ForeColor = System.Drawing.Color.Black; GridViewDayLoads.DataSource = LoadClass.GetLoadsByDate(DateTime.Now); GridViewDayLoads.DataBind(); } }
public static string UpdatePayStatus(int LoadID) { LoadClass load = new LoadClass(); load.ID = LoadID.ToString(); string msg; if (!load.Update_Load_Status(out msg)) { return(msg); } return("Done"); }
public static string DeleteItem(int ItemID) { LoadClass load = new LoadClass(); load.ID = ItemID.ToString(); string msg; if (!load.Delete_Load(out msg)) { return(msg); } return("Done"); }
public void ReadingAStringFromAField_1000() { //cache the item first Item preCache = _db.GetItem(itemPath); int tests = 10; int loops = 1000; long rawAverage = 0; long classAverage = 0; for (int j = 0; j < tests; j++) { Stopwatch watch1 = new Stopwatch(); watch1.Start(); for (int i = 0; i < loops; i++) { Item item = _db.GetItem(itemPath); string value = item["SingleLineText"]; } watch1.Stop(); Stopwatch watch2 = new Stopwatch(); watch2.Start(); for (int i = 0; i < loops; i++) { LoadClass item = _sitecore.GetItem <LoadClass>(itemPath); string value = item.SingleLineText; } watch2.Stop(); rawAverage += watch1.ElapsedMilliseconds; classAverage += watch2.ElapsedMilliseconds; Console.WriteLine("{2} Raw Sitecore Item: Number of loops {0} Total Time: {1}".Formatted(loops, watch1.ElapsedMilliseconds, j)); Console.WriteLine("{2} Glass Mapper Item: Number of loops {0} Total Time: {1}".Formatted(loops, watch2.ElapsedMilliseconds, j)); } Console.WriteLine("Raw Sitecore Item Average: {0}".Formatted(rawAverage / tests)); Console.WriteLine("Glass Mapper Item Average: {0}".Formatted(classAverage / tests)); }
private void LoadJSON_Click(object sender, RoutedEventArgs e) { var dialog = new OpenFileDialog { Filter = "Arquivos JSON|*.json|Todos os arquivos|*.*" }; dialog.FileOk += (_, __) => { Cursor = Cursors.Wait; LoadClass.LoadJSON(dialog.FileName); ((MainWindow)Application.Current.MainWindow).LoadedData(); Cursor = Cursors.Arrow; }; dialog.ShowDialog(); }
protected void BtnSave_Click(object sender, EventArgs e) { LoadClass load = new LoadClass(); load.ClientName = txtClientName.Text; load.DriverName = txtDriverName.Text; load.CarNumber = txtCarNumber.Text; load.EmptyLoad = txtEmptyLoad.Text == "" ? 0 : Convert.ToInt32(txtEmptyLoad.Text); load.FilledLoad = txtFilledLoad.Text == "" ? 0 : Convert.ToInt32(txtFilledLoad.Text); load.EmptyTime = txtEmptyTime.Text; load.FilledTime = txtFilledTime.Text; load.LoadDate = Convert.ToDateTime(txtDate.Text); load.LoadType = txtLoadType.Text; load.Notes = txtNotes.Text; load.Cost = txtCost.Text == "" ? 0 : Convert.ToDouble(txtCost.Text); load.IsPaid = CbIsPaid.Checked; load.IsResponsible = cbIsResponsible.Checked; if (!string.IsNullOrEmpty(txtCount.Text)) { load.LoadCount = Convert.ToInt32(txtCount.Text); } else { load.LoadCount = null; } string m, ID; if (!load.Add_Load(out m, out ID)) { lblSaveMsg.Text = m; lblSaveMsg.ForeColor = System.Drawing.Color.Red; } else { lblSaveMsg.Text = "تم بنجاح"; lblSaveMsg.ForeColor = System.Drawing.Color.Green; // use this flag in finish click btn to get rid of adding the same load twice ViewState["IsSaved"] = ID; } }
public void GetDataByMonth(int Year, int Month) { List <LoadClass> Loads = new List <LoadClass>(); string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; SqlConnection con = new SqlConnection(CS); SqlCommand cmd = new SqlCommand("SelectLoadsBYearAndMonth", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Year", SqlDbType.Int).Value = Year; cmd.Parameters.Add("@Month", SqlDbType.Int).Value = Month; con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { LoadClass load = new LoadClass(); load.ID = rdr["ID"].ToString(); load.ClientName = Convert.ToString(rdr["ClientName"]); load.DriverName = Convert.ToString(rdr["DriverName"]); load.CarNumber = Convert.ToString(rdr["CarNumber"]); load.LoadDate = Convert.ToDateTime(rdr["LoadDate"]); load.LoadType = Convert.ToString(rdr["LoadType"]); load.EmptyTime = Convert.ToString(rdr["EmptyTime"]); load.FilledTime = Convert.ToString(rdr["FilledTime"]); load.EmptyLoad = Convert.ToInt32(rdr["EmptyLoad"]); load.FilledLoad = Convert.ToInt32(rdr["FilledLoad"]); load.LoadCount = Convert.ToInt32(rdr["LoadCount"] is DBNull ? 0 : rdr["LoadCount"]); load.Cost = Convert.ToDouble(rdr["Cost"]); load.IsPaid = Convert.ToBoolean(rdr["IsPaid"]); Loads.Add(load); } rdr.Close(); con.Close(); JavaScriptSerializer js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(Loads)); }
protected void BtnGetInventory_Click(object sender, EventArgs e) { GridViewDayLoads.DataSource = LoadClass.GetLoadsByDate(Convert.ToDateTime(txtDate.Text)); GridViewDayLoads.DataBind(); }
protected override unsafe int OnLoadClass(CorDebugAppDomain pAppDomain, CorDebugClass c) { LoadClass?.Invoke(this, pAppDomain, c); return(Continue()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["ID"] != null) { LoadClass load = new LoadClass(); load.ID = Request.QueryString["ID"].ToString(); load.GetLoadByID(); txtClientName.Text = load.ClientName; txtDriverName.Text = load.DriverName; txtCarNumber.Text = load.CarNumber; txtDate.Text = load.LoadDate.ToShortDateString(); txtEmptyLoad.Text = load.EmptyLoad > 0 ? load.EmptyLoad.ToString() : ""; txtEmptyTime.Text = load.EmptyTime; txtFilledLoad.Text = load.FilledLoad > 0 ? load.FilledLoad.ToString() : ""; txtFilledTime.Text = load.FilledTime; txtLoadType.Text = load.LoadType; txtCost.Text = load.Cost.ToString(); txtNotes.Text = load.Notes; CbIsPaid.Checked = load.IsPaid; cbIsResponsible.Checked = load.IsResponsible; ViewState["ID"] = load.ID; lblEmptyTime.Text = load.EmptyTime; lblFilledTime.Text = load.FilledTime; if (!string.IsNullOrEmpty(load.Notes)) { lblNotes1.Visible = lblNotesTitle.Visible = true; lblNotes1.Text = load.Notes; } else { lblNotes1.Visible = lblNotesTitle.Visible = false; } if (load.LoadCount == null) { txtCount.Text = ""; } else { txtCount.Text = load.LoadCount.ToString(); } BtnSave.Visible = false; if (this.PreviousPage is Old_Load) { ((Button)((Site)Master).BtnOldLoad).BackColor = System.Drawing.Color.White; ((Button)((Site)Master).BtnOldLoad).ForeColor = System.Drawing.Color.Black; } else { ((Button)((Site)Master).BtnSearchLoads).BackColor = System.Drawing.Color.White; ((Button)((Site)Master).BtnSearchLoads).ForeColor = System.Drawing.Color.Black; } } else { ((Button)((Site)Master).BtnNewLoad).BackColor = System.Drawing.Color.White; ((Button)((Site)Master).BtnNewLoad).ForeColor = System.Drawing.Color.Black; } } }
protected void BtnFinish_Click(object sender, EventArgs e) { LoadClass load = new LoadClass(); load.ClientName = txtClientName.Text; load.DriverName = txtDriverName.Text; load.CarNumber = txtCarNumber.Text; load.EmptyLoad = txtEmptyLoad.Text == "" ? 0 : Convert.ToInt32(txtEmptyLoad.Text); load.FilledLoad = txtFilledLoad.Text == "" ? 0 : Convert.ToInt32(txtFilledLoad.Text); load.EmptyTime = txtEmptyTime.Text; load.FilledTime = txtFilledTime.Text; load.LoadDate = Convert.ToDateTime(txtDate.Text); load.LoadType = txtLoadType.Text; load.Notes = txtNotes.Text; load.Cost = txtCost.Text == "" ? 0 : Convert.ToDouble(txtCost.Text); load.IsPaid = CbIsPaid.Checked; load.IsResponsible = cbIsResponsible.Checked; if (!string.IsNullOrEmpty(txtCount.Text)) { load.LoadCount = Convert.ToInt32(txtCount.Text); } else { load.LoadCount = null; } string m, ID; bool Done = true; if (Request.QueryString["ID"] != null) { load.ID = ID = Request.QueryString["ID"].ToString(); if (!load.Update_Load(out m)) { lblSaveMsg.Text = m; lblSaveMsg.ForeColor = System.Drawing.Color.Red; Done = false; } } else { // check if the current load is saved before or not if (ViewState["IsSaved"] == null) { if (!load.Add_Load(out m, out ID)) { lblSaveMsg.Text = m; lblSaveMsg.ForeColor = System.Drawing.Color.Red; Done = false; } } else { ID = ViewState["IsSaved"].ToString(); } } if (Done) { load.ID = ID; lblDate.Text = txtDate.Text; lblID.Text = ID.ToString(); lblCarNumber.Text = txtCarNumber.Text; lblClientName.Text = txtClientName.Text; lblDriver.Text = txtDriverName.Text; lblLoadType.Text = txtLoadType.Text; lblFilledLoad.Text = txtFilledLoad.Text; lblEmptyLoad.Text = txtEmptyLoad.Text; if (!string.IsNullOrEmpty(load.Notes)) { lblNotes1.Visible = lblNotesTitle.Visible = true; lblNotes1.Text = load.Notes; } else { lblNotes1.Visible = lblNotesTitle.Visible = false; } lblNetLoad.Text = (Convert.ToInt32(txtFilledLoad.Text) - Convert.ToInt32(txtEmptyLoad.Text)).ToString(); if (load.LoadCount == null) { labelCount.Visible = false; lblCount.Visible = false; } else { labelCount.Visible = lblCount.Visible = true; lblCount.Text = txtCount.Text; } // get time for Loads load.GetLoadByID(); lblEmptyTime.Text = load.EmptyTime; lblFilledTime.Text = load.FilledTime; PanelFooter1.Visible = cbIsResponsible.Checked; PanelPrint.Visible = true; PanelLoadInfo.Visible = false; } }