//string gvHeaderStr = "Process,Date,JO,Customer,Production Line,Next_Production_line,Wash Type,Color,Size,Transaction Qty," + // "Previous Process,Create Date,Operator,Confirmed By,Confirmed Date,Confirmed,First Transfer,Pre-Process Closed"; protected void gvBody_RowDataBound(object sender, GridViewRowEventArgs e) { switch (e.Row.RowType) { case DataControlRowType.Header: //已经直接在SQL里面重命名和排序; //string[] hStr = gvHeaderStr.Split(new char[] { ',' }); //for (int i = 0; i < e.Row.Cells.Count; i++) //{ // e.Row.Cells[i].Text = hStr[i].ToString(); //} break; case DataControlRowType.DataRow: //Transaction Qty需要Total; Count = Count + int.Parse(e.Row.Cells[11].Text.Replace(" ", "0")); //8 Change 10 if (e.Row.Cells[3].Text != JO) { Qty = Qty + 1; } JO = e.Row.Cells[3].Text; break; case DataControlRowType.Footer: //注意修改[N]; e.Row.Cells[0].Text = "Total Count"; e.Row.Cells[6].Text = Qty.ToString(); e.Row.Cells[10].Text = "Total Qty"; e.Row.Cells[11].Text = Count.ToString(); break; } }
/// <summary> /// Overrides the ToString() in order to display messages /// </summary> /// <returns>Returns a formatted message</returns> public override string ToString() { string ctype; // Uses the value of Ctype to determine what the full name of the cookie type is if (Ctype == 'C') { ctype = "Cookie"; } else if (Ctype == 'O') { ctype = "Oatmeal"; } else { ctype = "Sugar"; } return("Order Number: " + ordnum.ToString("###,##0") + "\n" + "Customer Name: " + Custname + "\n" + "Phone Number: " + Pnum + "\n" + "Cookie Type: " + ctype + "\n" + "Quantity: " + Qty.ToString("###,##0") + "\n" + "Order Date: " + orddate.ToShortDateString() + "\n" + "Delivery Date: " + Delivdate.ToShortDateString()); }
/* * CONVERTS TO STRING (to later be displayed on a listbox)*/ public override string ToString() { if (Name.Length < 8) { return(ID.ToString() + "\t\t" + Name + "\t\t\t" + Qty.ToString() + '\t' + QtyReq.ToString()); } else { return(ID.ToString() + "\t\t" + Name + "\t\t" + Qty.ToString() + '\t' + QtyReq.ToString()); } }
private string GetSeperatedParameters() { return(OrgNo + ";" + FeeNo + ";" + RegNo + ";" + PriceCode + ";" + PriceName + ";" + StartDate + ";" + StartTime + ";" + EndDate + ";" + EndTime + ";" + Qty.ToString() + ";" + TakeTime + ";" + Id + ";" + Operation + ";" + FilePath + ";" + FileName); }
public string PrintTotal() { StringBuilder line = new StringBuilder(); if (IsImport) { line.Append("Imported "); } line.Append(Description + ": "); if (Qty > 1) { line.Append($"{TotalCost()} ({Qty.ToString()} @ {TotalPrice()})"); } else { line.Append(TotalCost()); } return(line.ToString()); }
public override string ToString() { string str = ""; str += "&idserver=\"" + IDServer.ToString() + "\""; if (IDUser != -1) { str += "&iduser=\"" + IDUser.ToString() + "\""; } if (IDCategory != 0) { str += "&idcategory=\"" + IDCategory.ToString() + "\""; } if (IDMealUnit != 0) { str += "&idmealunit=\"" + IDServerMealUnit.ToString() + "\""; } if (Qty != 0) { str += "&qty=\"" + Qty.ToString() + "\""; } if (MealDate != null) { str += "&mealdate=\"" + MealDate.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } if (InsertDate != null) { str += "&insertdate=\"" + InsertDate.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } if (UpdateDate != null) { str += "&updatedate=\"" + UpdateDate.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } return(str.Substring(1)); }
/// <summary> /// 加载页面数据 /// </summary> private void LoadData() { txtKeyId.Text = KeyId; txtFMarginEnd.Text = Qty.ToString(CultureInfo.InvariantCulture); txtFQty.Text = Qty.ToString(CultureInfo.InvariantCulture); switch (Actions) { case WebAction.Add: break; case WebAction.Edit: if (To != null) { txtFMarginEnd.Text = To.XMarginEnd.ToString(); ddlBill.SelectedValue = To.XBill; tbxFVehicleNum.Text = To.XVehicleNum; txtFQty.Text = To.XQty.ToString(); txtFMemo.Text = To.XMemo; } break; } }
private void Newstock() { divBack.Visible = true; decimal Qty; DataTable dtCollect = new DataTable(); dtCollect.Columns.Add("CreatedDate", typeof(DateTime)); dtCollect.Columns.Add("Qty", typeof(decimal)); dtCollect.Columns.Add("Productname"); dtCollect.Columns.Add("BQty", typeof(decimal)); dtCollect.Columns.Add("Balance", typeof(decimal)); decimal BQty = 0; string[] code = ddlSeasonYear.Text.Split(new string[] { "20" }, StringSplitOptions.None); DataTable dtUniqeCollectionDates = reportObj.GetCollectionDates(Convert.ToInt32(ddlProduct.SelectedValue), code[1].ToString()); DataTable dt = reportObj.GetNewallcollectionList(ddlProduct.SelectedValue, code[1].ToString()); foreach (DataRow Date in dtUniqeCollectionDates.Rows) { foreach (DataRow item in dt.Rows) { if (Date["CreatedDate"].ToString() == item["CreatedDate"].ToString()) { DataRow drNew = dtCollect.NewRow(); if (item["CollectionQty"].ToString().Contains("@")) { string[] CollectionQty = item["CollectionQty"].ToString().Split('@'); } else { string[] CollectionQty1 = item["CollectionQty"].ToString().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); Qty = 0; for (int i = 0; i < CollectionQty1.Length; i++) { Qty = Qty + Convert.ToDecimal(CollectionQty1[i].ToString()); } drNew["Qty"] = Qty.ToString(); } drNew["ProductName"] = item["ProductName"].ToString(); drNew["CreatedDate"] = Convert.ToDateTime(item["CreatedDate"]); drNew["BQty"] = "0.00"; drNew["Balance"] = "0.00"; dtCollect.Rows.Add(drNew); } } } DataTable dtblend1 = reportObj.GetSelectedBlendQty(code[1].ToString(), Convert.ToInt32(ddlProduct.SelectedValue)); for (int i = 0; i < dtblend1.Rows.Count; i++) { DataTable dtDate1 = reportObj.GetSelectedCollectionDate(dtblend1.Rows[i]["createddate"].ToString(), Convert.ToInt32(ddlProduct.SelectedValue)); if (dtblend1.Rows.Count > 0) { DataRow drNew1 = dtCollect.NewRow(); decimal BlendQty = 0; if (dtDate1.Rows.Count > 0) { if (dtDate1.Rows[0]["createddate"].ToString() == dtblend1.Rows[i]["createddate"].ToString()) { BlendQty = BlendQty + Convert.ToDecimal(dtblend1.Rows[i]["BQty"].ToString()); drNew1["Qty"] = "0.00"; drNew1["Productname"] = dtblend1.Rows[i]["ProductName"].ToString(); drNew1["CreatedDate"] = dtblend1.Rows[i]["createddate"].ToString(); drNew1["BQty"] = BlendQty.ToString(); dtCollect.Rows.Add(drNew1); } } else { drNew1["Qty"] = "0.00"; drNew1["Productname"] = dtblend1.Rows[i]["ProductName"].ToString(); drNew1["CreatedDate"] = dtblend1.Rows[i]["createddate"].ToString(); drNew1["BQty"] = dtblend1.Rows[i]["BQty"].ToString(); dtCollect.Rows.Add(drNew1); } } } DataView dv = dtCollect.DefaultView; dv.Sort = "CreatedDate asc"; DataTable sortedDT = dv.ToTable(); if (sortedDT.Rows.Count > 0) { for (int d = 0; d < sortedDT.Rows.Count; d++) { BQty = BQty + (Convert.ToDecimal(sortedDT.Rows[d]["Qty"].ToString()) - Convert.ToDecimal(sortedDT.Rows[d]["BQty"])); sortedDT.Rows[d]["Balance"] = BQty.ToString(); } } gvgvStockregister.DataSource = sortedDT; gvgvStockregister.DataBind(); decimal farmerCollTotal = dtCollect.AsEnumerable().Sum(m => m.Field <decimal>("Qty")); lblColleted.Text = Math.Round(farmerCollTotal, 1).ToString(); }
public string ToPostData(int index) { string postData = ""; if (Name != null) { postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_NAME" + index.ToString()) + "=" + HttpUtility.UrlEncode(Name) + "&"; } if (Desc != null) { postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_DESC" + index.ToString()) + "=" + HttpUtility.UrlEncode(Desc) + "&"; } if (Amt != 0) { postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_AMT" + index.ToString()) + "=" + Amt.ToString("F", CultureInfo.InvariantCulture) + "&"; } if (TaxAmt != 0) { postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_TAXAMT" + index.ToString()) + "=" + TaxAmt.ToString("F", CultureInfo.InvariantCulture) + "&"; } if (Number != 0) { postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_NUMBER" + index.ToString()) + "=" + Number.ToString(CultureInfo.InvariantCulture) + "&"; } if (Qty != 0) { postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_QTY" + index.ToString()) + "=" + Qty.ToString(CultureInfo.InvariantCulture) + "&"; } return(postData); }
private void btnAdd_Click(object sender, EventArgs e) { //Disclaimers Start if (cboxTitle.Text == "" || cboxType.Text == "" || cboxAuthor.Text == "" || cboxGenre.Text == "" || txtPages.Text == "" || txtPrice.Text == "" || txtQty.Text == "" || txtPublisher.Text == "") { MessageBox.Show("Stock cannot be added because, one or many of the nessasary fields are left blank. Please fill all the fields and try again", "Field Left Blank", MessageBoxButtons.OK, MessageBoxIcon.Error); goto End; } //Remove single & double quotes which cause sql troubles foreach (Control c in this.Controls) { if (c is TextBox || c is ComboBox) { c.Text = c.Text.Replace("'", ""); c.Text = c.Text.Replace("\"", ""); } } int Qty; bool q = int.TryParse(txtQty.Text, out Qty); if (q == false) { MessageBox.Show("Insert a valid value for No. of books", "Invalid no. of books", MessageBoxButtons.OK, MessageBoxIcon.Error); goto End; } //Disclaimers End //Declarations string Title = cboxTitle.Text; string Maxbook = "B0000"; string BookID; double Price, Trans; Methods methods = new Methods(); //When Creating new title. if (TitleNew == true) { //Disclaimer + integer Declarations int Pages; bool pg = int.TryParse(txtPages.Text, out Pages); bool p = double.TryParse(txtPrice.Text, out Price); if (q == false || p == false || pg == false) { MessageBox.Show("Insert a valid value for No. of books, No. Pages or Price"); goto End; } //Declarations string Type, Author, Genre, ISBN, Publisher; TitleID = ""; Author = cboxAuthor.Text; Genre = cboxGenre.Text; ISBN = txtISBN.Text; Publisher = txtPublisher.Text; if (cboxType.SelectedIndex == 0) { Type = "CLend"; } else if (cboxType.SelectedIndex == 1) { Type = "ALend"; } else { Type = "Ref"; } //Creating New TitleID { //Getting MaxID from Databse string sqlMaxTitle = "SELECT MAX(TitleID) as MaxTitle, COUNT(TitleID) as CountID FROM Title"; OleDbCommand cmdMaxTitle = new OleDbCommand(sqlMaxTitle, db.con); if (db.con.State.Equals(ConnectionState.Closed)) { db.con.Open(); } OleDbDataReader drMaxTitle = cmdMaxTitle.ExecuteReader(); drMaxTitle.Read(); //If there are titles in DB, formulate a new TitleID if (drMaxTitle["CountID"].ToString() != "0") { // Calling NewID method TitleID = methods.NewID(drMaxTitle["MaxTitle"].ToString()); } else { TitleID = "T0001"; } } //Declartions End //Add Values to Relation: Title string sqlTitleNew = string.Format("INSERT INTO Title(TitleID, BTitle, BType, Price, Genre, ISBN, Pg, Author, Publisher) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}')", TitleID, Title, Type, Price, Genre, ISBN, Pages, Author, Publisher); OleDbCommand cmdTitleNew = new OleDbCommand(sqlTitleNew, db.con); if (db.con.State.Equals(ConnectionState.Closed)) { db.con.Open(); } cmdTitleNew.ExecuteNonQuery(); } else { Price = double.Parse(txtPrice.Text); } // Get the highest BookID from Database string sqlMaxBook = "SELECT MAX(BookID) as MaxBook, COUNT(BookID) as CountID FROM Book"; OleDbCommand cmdMaxBook = new OleDbCommand(sqlMaxBook, db.con); if (db.con.State.Equals(ConnectionState.Closed)) { db.con.Open(); } OleDbDataReader drMaxbook = cmdMaxBook.ExecuteReader(); drMaxbook.Read(); if (drMaxbook["CountID"].ToString() != "0") { Maxbook = drMaxbook["MaxBook"].ToString(); } else { Maxbook = "B0000"; } // Adding books in a loop. for (int book = 1; book <= Qty; book++) { //Calling new ID method to create newID BookID = methods.NewID(Maxbook); //Adding a book with such book ID & TitleID to DB string sqlbook = string.Format("INSERT INTO Book (BookID, TitleID) VALUES ('{0}','{1}')", BookID, TitleID); OleDbCommand cmdbook = new OleDbCommand(sqlbook, db.con); if (db.con.State.Equals(ConnectionState.Closed)) { db.con.Open(); } cmdbook.ExecuteNonQuery(); //Make the BookID as the new Book_MaxID to help the next loop Maxbook = BookID; } Maxbook = ""; BookID = ""; // Adding Transaction details Trans = Price * Qty; string TDetail = string.Format("{0} books under the Title: {1}", Qty, Title); string sqlTrans = string.Format("INSERT INTO Cash (TDate, Amount, TDetail, Event) VALUES('{0}', {1}, '{2}', 'NewStock')", DateTime.Now.ToString(), -Trans, TDetail); OleDbCommand cmdTrans = new OleDbCommand(sqlTrans, db.con); cmdTrans.ExecuteNonQuery(); // Transactions added. //Successful Message MessageBox.Show(string.Format("{0} Book(s) and/or Book Title have been added to collection and transaction has been recorded successfully", Qty.ToString()), "Books Successfully Added", MessageBoxButtons.OK, MessageBoxIcon.Information); //Reset form this.Close(); frmAddBook f = new frmAddBook(); f.Show(); End : if (db.con.State.Equals(ConnectionState.Open)) { db.con.Close(); } }
public override string ToString() { return($"Sell Item: {SellItem.ToString()} Qty: {Qty.ToString()}"); }