public void SaveQRCode() { if (qrCode) { IOClass.SaveQRCodeToGallery(qrCode); } else { Debug.Log("No QR code to save."); } }
private void ShowBidTenders() { #region Code for preparing the DataTable BidTenderTransaction bt = new BidTenderTransaction(); int count = 0; DataTable dtTenders = bt.GetBidTenders(connstring, ViewState[Constant.SESSION_BIDREFNO].ToString().Trim(), ViewState[Constant.SESSION_USERID].ToString().Trim(), ref count); Session["Mode_BidTenders"] = ((count == 0) ? "Add" : "Edit"); //Create an instance of DataTable DataTable dt = new DataTable(); DataColumn dcol = new DataColumn(ID, typeof(System.String)); dcol = new DataColumn("ITEM", typeof(System.String)); dt.Columns.Add(dcol); dcol = new DataColumn("AMOUNT", typeof(System.String)); dt.Columns.Add(dcol); dcol = new DataColumn("TENDERDATE", typeof(System.String)); dt.Columns.Add(dcol); dcol = new DataColumn("BIDTENDERNO", typeof(System.String)); dt.Columns.Add(dcol); dcol = new DataColumn("BIDDETAILNO", typeof(System.String)); dt.Columns.Add(dcol); //Now add data for dynamic columns for (int i = 0; i < dtTenders.Rows.Count; i++) { //Create a new row DataRow drow = dt.NewRow(); drow["ITEM"] = dtTenders.Rows[i]["ITEM"].ToString().Trim(); drow["AMOUNT"] = ((i == dtTenders.Rows.Count - 1) ? "Last|" + dtTenders.Rows[i]["AMOUNT"].ToString().Trim() : dtTenders.Rows[i]["AMOUNT"].ToString().Trim()); drow["TENDERDATE"] = "DATE|" + dtTenders.Rows[i]["TENDERDATEMONTH"].ToString().Trim() + "/" + dtTenders.Rows[i]["TENDERDATEDAY"].ToString().Trim() + "/" + dtTenders.Rows[i]["TENDERDATEYEAR"].ToString().Trim(); drow["BIDTENDERNO"] = dtTenders.Rows[i]["BIDTENDERNO"].ToString().Trim(); drow["BIDDETAILNO"] = dtTenders.Rows[i]["BIDDETAILNO"].ToString().Trim(); dt.Rows.Add(drow); } IOClass IO = new IOClass(); IO.WriteIndexToFile(dtTenders.Rows.Count.ToString().Trim(), Session[Constant.SESSION_USERID].ToString().Trim()); BidTenderGeneral bidtender = new BidTenderGeneral(); bidtender = bt.QueryBidTendersGeneral(ViewState[Constant.SESSION_BIDREFNO].ToString().Trim(), ViewState[Constant.SESSION_USERID].ToString().Trim()); Session["Mode_BidTendersGeneral"] = bidtender.Mode_BidTendersGeneral.ToString().Trim(); DataRow drow1 = dt.NewRow(); drow1["ITEM"] = "Discount"; drow1["AMOUNT"] = "Discount|" + bidtender.Discount.ToString().Trim(); drow1["TENDERDATE"] = "Discount|NONE"; dt.Rows.Add(drow1); DataRow drow2 = dt.NewRow(); drow2["ITEM"] = "Total Cost"; drow2["AMOUNT"] = "Total Cost|" + bidtender.TotalCost.ToString().Trim(); drow2["TENDERDATE"] = "Total Cost|NONE"; dt.Rows.Add(drow2); DataRow drow3 = dt.NewRow(); drow3["ITEM"] = "Delivery Cost"; drow3["AMOUNT"] = "Delivery Cost|" + bidtender.DeliveryCost.ToString().Trim(); drow3["TENDERDATE"] = "Delivery Cost|NONE"; dt.Rows.Add(drow3); DataRow drow4 = dt.NewRow(); drow4["ITEM"] = "Total Extended Cost"; drow4["AMOUNT"] = "Total Extended Cost|" + bidtender.TotalExtendedCost.ToString().Trim(); drow4["TENDERDATE"] = "Total Extended Cost|NONE"; dt.Rows.Add(drow4); DataRow drow5 = dt.NewRow(); drow5["ITEM"] = "Incoterm"; drow5["AMOUNT"] = "Incoterm|" + bidtender.Incoterm.ToString().Trim(); drow5["TENDERDATE"] = "Incoterm|NONE"; dt.Rows.Add(drow5); DataRow drow6 = dt.NewRow(); drow6["ITEM"] = "Payment Terms"; drow6["AMOUNT"] = "Payment Terms|" + bidtender.PaymentTerms.ToString().Trim(); drow6["TENDERDATE"] = "Payment Terms|NONE"; dt.Rows.Add(drow6); DataRow drow7 = dt.NewRow(); drow7["ITEM"] = "Warranty"; drow7["AMOUNT"] = "Warranty|" + bidtender.Warranty.ToString().Trim(); drow7["TENDERDATE"] = "Warranty|NONE"; dt.Rows.Add(drow7); DataRow drow8 = dt.NewRow(); drow8["ITEM"] = "Remarks"; drow8["AMOUNT"] = "Remarks|" + bidtender.Remarks.ToString().Trim(); drow8["TENDERDATE"] = "Remarks|NONE"; dt.Rows.Add(drow8); #endregion //Iterate through the columns of the datatable to set the data bound field dynamically. foreach (DataColumn col in dt.Columns) { //Declare the bound field and allocate memory for the bound field. CustomBoundField bfield = new CustomBoundField(); //Initalize the DataField value. bfield.DataField = col.ColumnName; bfield.HeaderStyle.CssClass = "itemDetails_th"; switch (col.ColumnName) { case "ITEM": //Initialize the HeaderText field value. bfield.HeaderText = "Item"; bfield.HeaderType = Constant.HEADER_TYPE_LABEL.ToString().Trim(); bfield.ItemStyle.CssClass = "itemDetails_td"; bfield.DataField = "ITEM"; bfield.VendorId = Session[Constant.SESSION_USERID].ToString().Trim(); bfield.Editable = false; bfield.Date = false; bfield.Label2 = false; bfield.Label4 = true; bfield.LabelDate = false; break; case "AMOUNT": //Initialize the HeaderText field value. bfield.HeaderText = "Item Cost"; bfield.HeaderType = Constant.HEADER_TYPE_LABEL.ToString().Trim(); bfield.DataField = "AMOUNT"; bfield.ItemStyle.CssClass = "valueGridItem"; bfield.VendorId = Session[Constant.SESSION_USERID].ToString().Trim(); bfield.Editable = false; bfield.Date = false; bfield.Label2 = true; bfield.Label4 = false; bfield.LabelDate = false; break; case "TENDERDATE": //Initialize the HeaderText field value. bfield.HeaderText = "Delivery Date"; bfield.HeaderType = Constant.HEADER_TYPE_LABEL.ToString().Trim(); bfield.ItemStyle.CssClass = "valueGridItem"; bfield.DataField = "TENDERDATE"; bfield.VendorId = Session[Constant.SESSION_USERID].ToString().Trim(); bfield.Editable = false; bfield.Date = false; bfield.Label2 = false; bfield.Label4 = false; bfield.LabelDate = true; break; case "BIDTENDERNO": //Initialize the HeaderText field value. bfield.HeaderText = col.ColumnName; bfield.Visible = false; bfield.HeaderType = Constant.HEADER_TYPE_LABEL.ToString().Trim(); bfield.DataField = "BIDTENDERNO"; bfield.Editable = false; bfield.Date = false; break; case "BIDDETAILNO": //Initialize the HeaderText field value. bfield.HeaderText = col.ColumnName; bfield.Visible = false; bfield.HeaderType = Constant.HEADER_TYPE_LABEL.ToString().Trim(); bfield.DataField = "BIDDETAILNO"; bfield.Editable = false; bfield.Date = false; break; } //Add the newly created bound field to the GridView. gvBids.Columns.Add(bfield); } gvBids.DataSource = dt; gvBids.DataBind(); }
private void button2_Click(object sender, EventArgs e) { ParametersClass.AutostartValue = false; IOClass.SaveGlobalJson(LoginBox.Text, PasswordBox.Text); SetAutorunValue(false); }
private void Form1_Load(object sender, EventArgs e) { ParametersClass.timertoautopost = timertoautopost; if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\Json")) { Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\Json"); } if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\Json" + "\\groups")) { Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\Json" + "\\groups"); } if (File.Exists(ParametersClass.GlobalJson)) { GlobalParametersJson globalParametersJson = IOClass.ReadGlobalJson(); LoginBox.Text = globalParametersJson.LoginT; PasswordBox.Text = globalParametersJson.PassT; ParametersClass.ip = globalParametersJson.Ip; ParametersClass.token = globalParametersJson.Token; ParametersClass.AutostartValue = globalParametersJson.AutoStart; } else { using (FileStream fs = File.Create(ParametersClass.GlobalJson)) { fs.Close(); fs.Dispose(); } IOClass.SaveGlobalJson(LoginBox.Text, PasswordBox.Text); } string[] groups = Directory.GetFiles(System.Windows.Forms.Application.StartupPath + "\\Json" + "\\groups"); for (int i = 0; i < groups.Length; i++) { GroupItem groupItem = IOClass.ReadGroupJson(groups[i]); TimeClass time = new TimeClass(groupItem.Hour, groupItem.Minute, groupItem.Yer, groupItem.Mounth, groupItem.Day, groupItem.PostSpace); Classes.Group group = new Classes.Group(Path.GetFileNameWithoutExtension(groups[i]), time); group.groupItem = groupItem; ParametersClass.groups.Add(group); } if (groups.Length == 0) { ParametersClass.groups.Add(GroupManager.CreateGroup("Default", true)); GroupManager.SaveAllGroup(); LastIndex = 0; } if (File.Exists(ParametersClass.logsPath)) { ParametersClass.logs = IOClass.ReadLogsJson(); } if (ParametersClass.logs == null) { ParametersClass.logs = new List <Logs>(); } AutoPostStop.Enabled = false; if (ParametersClass.AutostartValue) { this.ShowInTaskbar = false; this.WindowState = FormWindowState.Minimized; this.FormBorderStyle = FormBorderStyle.SizableToolWindow; notifyIcon1.Icon = this.Icon; notifyIcon1.BalloonTipIcon = ToolTipIcon.Info; notifyIcon1.BalloonTipText = "DesuBot работает в автоматическом режиме. Работа начнётся через 10 минут."; notifyIcon1.BalloonTipTitle = "DesuBot"; notifyIcon1.ShowBalloonTip(12); AutoPostStop.Enabled = true; } else { this.WindowState = FormWindowState.Normal; this.FormBorderStyle = FormBorderStyle.Sizable; } try { label11.Text = "Количество вайлов в папке: " + Directory.GetFiles(patchToPublic.Text).Length; } catch { } string nowIP = new WebClient().DownloadString("http://bot.whatismyipaddress.com"); if (ParametersClass.ip != nowIP) { ParametersClass.ip = nowIP; if (ParametersClass.AutostartValue) { VkApiClass.Auth(LoginBox.Text, PasswordBox.Text, ButtonLogin); } } else if (ParametersClass.AutostartValue == true && ParametersClass.ip == nowIP) { VkApiClass.Auth(LoginBox.Text, PasswordBox.Text, ButtonLogin); } else { try { ParametersClass.vkapi.Authorize(new ApiAuthParams { AccessToken = ParametersClass.token }); if (ParametersClass.AutostartValue) { timertoautopost.Enabled = true; } else { MessageBox.Show("Успешная авторизация через токен."); } ParametersClass.autch = true; ButtonLogin.BackColor = Color.Lime; } catch { ParametersClass.autch = false; ButtonLogin.BackColor = Color.Red; if (ParametersClass.AutostartValue) { VkApiClass.Auth(LoginBox.Text, PasswordBox.Text, ButtonLogin); } else { MessageBox.Show("Авторизация через токен не удалась."); } } } UpdateGroupList(); groupList.SelectedIndex = LastIndex; UpdateGUI(); }
private void Saves_Click(object sender, EventArgs e) { IOClass.SaveGlobalJson(LoginBox.Text, PasswordBox.Text); GroupManager.SaveAllGroup(); }
private void SaveBidTender(string Status) { #region GetBidTenderCount IOClass IO = new IOClass(); int line = IO.GetTenderCount(ViewState[Constant.SESSION_USERID].ToString().Trim()); int i = 0; #endregion #region Declare Variables double dblTotalAmount = 0; double dblTotalCost = 0; double dblTotalExtendedCost = 0; string vTotalCost = ""; string vTotalExtendedCost = ""; string vAmount = ""; string vDiscount = ""; string vDeliveryCost = ""; string vIncoterm = ""; string vPayment = ""; string vWarranty = ""; string vRemarks = ""; #endregion #region GetValuesFromRowsAndSave foreach (GridViewRow gvr in gvBidDetails2.Rows) { if (i < line) { vAmount = ((TextBox)gvr.Cells[1].Controls[0]).Text; if (vAmount != "") { dblTotalAmount = dblTotalAmount + Convert.ToDouble(vAmount); } string vDay = ((TextBox)gvr.Cells[2].Controls[1]).Text; string vMonth = ((DropDownList)gvr.Cells[2].Controls[0]).SelectedItem.Value; string vYear = ((TextBox)gvr.Cells[2].Controls[2]).Text; string vBidTenderNo = ((Label)gvr.Cells[3].Controls[0]).Text; string vBidDetailNo = ((Label)gvr.Cells[4].Controls[0]).Text; //vBidTenderNo = SaveTenderToDataBase(vBidDetailNo, vAmount, vMonth + '/' + vDay + '/' + vYear, ViewState[Constant.SESSION_USERID].ToString().Trim(), vBidTenderNo, "0"); } else { switch (i - line) { case 0: vDiscount = ((TextBox)gvr.Cells[1].Controls[1]).Text; if (vDiscount != "") { dblTotalCost = dblTotalAmount - Convert.ToDouble(vDiscount); } else { dblTotalCost = dblTotalAmount; } break; case 1: vTotalCost = ((TextBox)gvr.Cells[1].Controls[0]).Text; vTotalCost = dblTotalCost.ToString().Trim(); break; case 2: vDeliveryCost = ((TextBox)gvr.Cells[1].Controls[0]).Text; if (vDeliveryCost != "") { dblTotalExtendedCost = dblTotalCost + Convert.ToDouble(vDeliveryCost); } else { dblTotalExtendedCost = dblTotalCost; } break; case 3: vTotalExtendedCost = ((TextBox)gvr.Cells[1].Controls[0]).Text; vTotalExtendedCost = dblTotalExtendedCost.ToString().Trim(); break; case 4: vIncoterm = ((DropDownList)gvr.Cells[1].Controls[0]).SelectedItem.Value; break; case 5: vPayment = ((TextBox)gvr.Cells[1].Controls[0]).Text; break; case 6: vWarranty = ((TextBox)gvr.Cells[1].Controls[0]).Text; break; case 7: vRemarks = ((TextBox)gvr.Cells[1].Controls[0]).Text; break; } } i++; } BidTenderTransaction bt = new BidTenderTransaction(); if (Session["Mode_BidTendersGeneral"].ToString().Trim() != "Edit") { bt.InsertBidTenderGeneralToDataBase(connstring, ViewState["BidRefNo"].ToString().Trim(), ViewState[Constant.SESSION_USERID].ToString().Trim(), ddlPreferredCurrency.SelectedItem.Value, vDiscount, vTotalCost, vDeliveryCost, vTotalExtendedCost, vIncoterm, vPayment, vWarranty, vRemarks, Status); Session["Mode_BidTendersGeneral"] = "Edit"; } else { bt.UpdateBidTenderGeneralToDataBase(ViewState["BidRefNo"].ToString().Trim(), ViewState[Constant.SESSION_USERID].ToString().Trim(), ddlPreferredCurrency.SelectedItem.Value, vDiscount, vTotalCost, vDeliveryCost, vTotalExtendedCost, vIncoterm, vPayment, vWarranty, vRemarks, Status); } //SaveComment(); #endregion }