private string TotalService(string year) { SQLCon.DbCon(); SQLCon.dataTable = new DataTable(); SQLCon.sqlDataApater = new SqlDataAdapter( @"SELECT * from ServiceRequestInfoes where YEAR(DateAccomplished) = @3 ", SQLCon.sqlConnection); SQLCon.sqlDataApater.SelectCommand.Parameters.AddWithValue("@3", Int32.Parse(year)); SQLCon.sqlDataApater.Fill(SQLCon.dataTable); int i = 0; foreach (DataRow row in SQLCon.dataTable.Rows) { i++; } string number; number = i.ToString(); return(number); }
// POST : Login public ActionResult Index(string username, string password) { SqlConnection con = SQLCon.getConnection(); SqlCommand q = con.CreateCommand(); q.CommandType = CommandType.Text; q.CommandText = "SELECT TOP 1 * FROM [User] WHERE email='" + username + "' AND password='******'"; SqlDataReader result = q.ExecuteReader(); if (result.HasRows) { result.Read(); User user = new User { firstName = result["firstname"].ToString(), lastName = result["lastname"].ToString(), email = result["email"].ToString(), password = result["password"].ToString(), address = result["address"].ToString(), bankDetails = result["bankdetails"].ToString(), id = Int32.Parse(result["id"].ToString()) }; Session["loggedUser"] = user; return(RedirectToAction("Index", "Home")); } ViewBag.loginFailed = true; return(View()); }
private string GetOthers(string count, string year) { SQLCon.DbCon(); SQLCon.dataTable = new DataTable(); SQLCon.sqlDataApater = new SqlDataAdapter( @"SELECT * from ServiceRequestInfoes where NOT TypeOfServiceProvided like '%DESKTOP%' and NOT TypeOfServiceProvided like '%LAPTOP%' and NOT TypeOfServiceProvided like '%PRINTER%' and NOT TypeOfServiceProvided like '%NETWORK%' and YEAR(DateAccomplished) = @3 ", SQLCon.sqlConnection); SQLCon.sqlDataApater.SelectCommand.Parameters.AddWithValue("@3", Int32.Parse(year)); SQLCon.sqlDataApater.Fill(SQLCon.dataTable); int i = 0; foreach (DataRow row in SQLCon.dataTable.Rows) { i++; } string number; number = i.ToString(); return(number); }
public void BackupDatabase(string dest) { SQLiteConnection backupCon = null; if (dest.StartsWith(@"\\")) { backupCon = new SQLiteConnection(string.Format("Data Source={0};Compress=True;UTF8Encoding=True;", dest), true); } else { new SQLiteConnection(string.Format("Data Source={0};Compress=True;UTF8Encoding=True;", dest)); } backupCon.Open(); SQLCon.Open(); SQLCon.BackupDatabase(backupCon, backupCon.Database, SQLCon.Database, -1, null, -1); SQLCon.Close(); backupCon.Close(); backupCon.Dispose(); // delete old logs - we have them in the backup which got created using (SQLiteCommand delCmd = new SQLiteCommand("DELETE FROM LOGGING WHERE Timestamp <= date('now', '-30 day'); VACUUM;", SQLCon)) { SQLCon.Open(); delCmd.ExecuteNonQuery(); SQLCon.Close(); } }
public AddShard() { InitializeComponent(); CertSQL.SQLCon a = new SQLCon(); a.DBConfig.Open(); a.SQLCMD = new SqlCommand("SELECT szName FROM _Farm", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Farm.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.SQLCMD = new SqlCommand("SELECT szName FROM _Content", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Content.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.SQLCMD = new SqlCommand("DECLARE @ModuleID TINYINT; SELECT @ModuleID = nID FROM _Module WHERE szModuleName = 'SR_ShardManager'; SELECT nID FROM _ServerBody WHERE nModuleID = @ModuleID", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { //StartupShardMgr.Items.Add("[" + SQLReader.GetInt16(0) + "]" + " - SR_ShardManager"); StartupShardMgr.Items.Add(a.SQLReader.GetInt16(0)); } a.SQLReader.Close(); a.DBConfig.Close(); }
public AddServerMachine() { InitializeComponent(); CertSQL.SQLCon a = new SQLCon(); a.DBConfig.Open(); a.SQLCMD = new SqlCommand("SELECT szName FROM _Division", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Division.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.DBConfig.Close(); PublicIP.Items.Add("127.0.0.1"); // Use 127.0.0.1 only for Certification Module PrivateIP.Items.Add("127.0.0.1"); // Use 127.0.0.1 only for Certification Module IPHostEntry Host = Dns.GetHostEntry(Dns.GetHostName());; foreach (IPAddress IP in Host.AddressList) { PublicIP.Items.Add(IP.ToString()); PrivateIP.Items.Add(IP.ToString()); } }
private void button1_Click(object sender, EventArgs e) { if (Division.Text == "" || Farm.Text == "") { MessageBox.Show("Please fill the farm data!!!", "WARNING!!!"); } else { CertSQL.SQLCon a = new SQLCon(); a.DBConfig.Open(); a.SQLCMD = new SqlCommand("SELECT nID FROM _Division WHERE szName = '" + Division.Text + "'", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); a.SQLReader.Read(); var DivisionID = a.SQLReader.GetSqlByte(0); a.SQLReader.Close(); // EXEC _AddFarm @DivisionID, @FarmName a.SQLCMD = new SqlCommand("_AddFarm", a.DBConfig); a.SQLCMD.CommandType = CommandType.StoredProcedure; a.SQLCMD.Parameters.Add("@DivisionID", SqlDbType.TinyInt).Value = DivisionID; a.SQLCMD.Parameters.Add("@FarmName", SqlDbType.VarChar).Value = Farm.Text; a.SQLCMD.ExecuteNonQuery(); /// a.DBConfig.Close(); MessageBox.Show("Successfully added new farm!\nDivision: " + Division.Text + "\nFarm: " + Farm.Text, "Success"); } }
// GET: PostItem public ActionResult Index() { if (Session["loggedUser"] == null) { return(RedirectToAction("Index", "Login")); } SqlConnection con = SQLCon.getConnection(); SqlCommand q = con.CreateCommand(); q.CommandType = CommandType.Text; q.CommandText = "SELECT * FROM [Category]"; SqlDataReader result = q.ExecuteReader(); List <Category> categories = new List <Category>(); while (result.Read()) { categories.Add(new Category { id = Int32.Parse(result["id"].ToString()), name = result["name"].ToString(), item_count = Int32.Parse(result["item_count"].ToString()) }); } ViewBag.categories = categories; return(View()); }
public String Index(int remove_id) { SqlConnection con = SQLCon.getConnection(); SqlCommand q = con.CreateCommand(); q.CommandType = CommandType.Text; q.CommandText = "SELECT TOP 1 category_id FROM [Item] WHERE id='" + remove_id + "'"; SqlDataReader result = q.ExecuteReader(); if (result.HasRows) { result.Read(); int category_id = Int32.Parse(result["category_id"].ToString()); result.Close(); q.CommandText = "DELETE FROM [Item] WHERE id='" + remove_id + "'"; if (q.ExecuteNonQuery() > 0) { q.CommandText = "UPDATE [Category] SET item_count=item_count-1 WHERE id='" + category_id + "'"; if (q.ExecuteNonQuery() > 0) { q.CommandText = "DELETE FROM [Order] WHERE item_id='" + remove_id + "'"; q.ExecuteNonQuery(); return("OK"); } } } return("ERROR"); }
private SQLiteDB(string file) { if (!System.IO.File.Exists(file)) { // create a new database SQLiteConnection.CreateFile(file); } BasePath = (new System.IO.FileInfo(file)).DirectoryName; DbPath = file; if (file.StartsWith(@"\\")) { SQLCon = new SQLiteConnection(string.Format("DATA Source={0};Compress=True;UTF8Encoding=True;", file), true); } else { SQLCon = new SQLiteConnection(string.Format("DATA Source={0};Compress=True;UTF8Encoding=True;", file)); } // create default table structures (if not exist // create properties SQLiteCommand createCmds = new SQLiteCommand("CREATE TABLE IF NOT EXISTS FOLDERS (FOLDERNAME VARCHAR(8000) NOT NULL COLLATE NOCASE, ISACTIVE INTEGER NOT NULL DEFAULT 1, CREATIONDATE DATETIME DEFAULT CURRENT_TIMESTAMP, REMOVEDATE DATETIME DEFAULT NULL);", SQLCon); // create matter logging SQLiteCommand logCmds = new SQLiteCommand("CREATE TABLE IF NOT EXISTS LOGGING (Timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, FOLDERNAME varchar(8000) COLLATE NOCASE, message varchar(8000))", SQLCon); SQLCon.Open(); createCmds.ExecuteNonQuery(); logCmds.ExecuteNonQuery(); SQLCon.Close(); createCmds.Dispose(); logCmds.Dispose(); }
private void rptQuerKalkulation_DataSourceDemanded(object sender, EventArgs e) { try { this.p_Rpt_QuerCalculationTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_QuerCalculationTableAdapter.ClearBeforeFill = true; this.p_Rpt_QuerCalculationTableAdapter.Fill(dsQuerKalculation1.P_Rpt_QuerCalculation, dtValue, _PID, _Type, _LVSection); this.p_Rpt_QuerCalculation_SurchargePositionTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_QuerCalculation_SurchargePositionTableAdapter.ClearBeforeFill = true; this.p_Rpt_QuerCalculation_SurchargePositionTableAdapter.Fill(dsSurchargeCalculation1.P_Rpt_QuerCalculation_SurchargePosition, dtValue, _PID, _Type, _LVSection); DataTable dt = new DataTable(); dt = dsSurchargeCalculation1.P_Rpt_QuerCalculation_SurchargePosition; if (dt != null) { decimal _result = 0; if (decimal.TryParse(Convert.ToString(dt.Rows[0][0]), out _result)) { if (_result == 0) { tblSurchargeresult.Text = string.Empty; } else { tblSurchargeresult.Text = _result.ToString("n2"); } } } dsDiscountCalculation ds = new dsDiscountCalculation(); this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter1.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter1.ClearBeforeFill = true; this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter1.Fill(ds.P_Rpt_QuerCalculation_DiscountPosition, dtValue, _PID, _Type, _LVSection); DataTable dtdiscount = new DataTable(); dtdiscount = ds.P_Rpt_QuerCalculation_DiscountPosition; if (dtdiscount != null) { decimal _result = 0; if (decimal.TryParse(Convert.ToString(dtdiscount.Rows[0][0]), out _result)) { if (_result > 0) { tbDiscountResult.Text = _result.ToString("n2"); _Discount = Convert.ToDouble(_result); } else { tbDiscountResult.Text = string.Empty; _Discount = 0; } } } } catch (Exception ex) { Utility.ShowError(ex); } }
public ActionResult Index(string editRequest, string firstname, string lastname, string password, string address, string bankdetails) { SqlConnection con = SQLCon.getConnection(); User luser = (User)Session["loggedUser"]; SqlCommand q1 = con.CreateCommand(); q1.CommandType = CommandType.Text; q1.CommandText = "UPDATE [User] SET password='******',firstname='" + firstname + "',lastname='" + lastname + "',address='" + address + "',bankdetails='" + bankdetails + "' WHERE id='" + luser.id + "'"; q1.ExecuteNonQuery(); SqlCommand q = con.CreateCommand(); q.CommandType = CommandType.Text; q.CommandText = "SELECT TOP 1 * FROM [User] WHERE id='" + luser.id + "'"; SqlDataReader result = q.ExecuteReader(); /* update session */ if (result.HasRows) { result.Read(); User user = new User { firstName = result["firstname"].ToString(), lastName = result["lastname"].ToString(), email = result["email"].ToString(), password = result["password"].ToString(), address = result["address"].ToString(), bankDetails = result["bankdetails"].ToString(), id = Int32.Parse(result["id"].ToString()) }; Session["loggedUser"] = user; } return(RedirectToAction("Index", "MyProfile")); }
public ActionResult Index(string registerRequest, string firstname, string lastname, string emailaddress, string password, string address, string bankdetails) { SqlConnection con = SQLCon.getConnection(); SqlCommand q0 = con.CreateCommand(); q0.CommandType = CommandType.Text; q0.CommandText = "SELECT TOP 1 * FROM [User] WHERE email='" + emailaddress + "';"; SqlDataReader result0 = q0.ExecuteReader(); if (result0.HasRows) { result0.Close(); return(RedirectToAction("EmailExists", "Register")); } else { result0.Close(); SqlCommand q1 = con.CreateCommand(); q1.CommandType = CommandType.Text; q1.CommandText = "INSERT INTO [User](email,password,firstname,lastname,address,bankdetails) VALUES('" + emailaddress + "','" + password + "','" + firstname + "','" + lastname + "','" + address + "','" + bankdetails + "');"; if (q1.ExecuteNonQuery() > 0) { return(RedirectToAction("Success", "Register")); } } return(View()); }
public AssignFarmContent() { InitializeComponent(); CertSQL.SQLCon a = new SQLCon(); a.DBConfig.Open(); a.SQLCMD = new SqlCommand("SELECT szName FROM _Farm", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Farm.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.SQLCMD = new SqlCommand("SELECT szName FROM _Content", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Content.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.DBConfig.Close(); }
private void LoadListRequest() { SQLCon.DbCon(); SQLCon.sqlDataApater = new SqlDataAdapter( @"SELECT er_ID, partyOrganization AS [Organization], contactPerson, contactNo, titleOfEvent AS [Title of Event], dateOfEvent AS [Date of Event], timeOfEvent AS [Time of Event], venueOfEvent AS [Venue of Event], granted AS [Granted], denied AS [Denied], pd_Solo, pd_Duet, pd_Chorale, pd_RondallaBand, pd_FolkDance, pd_HipHop, pd_Contemporary, pd_DanceSports, noOfPerformance, noOfPerformer, bitaw, specify, denied_Reason, notedBy, ApprovedBy FROM ExternalRequests", SQLCon.sqlConnection); SQLCon.dataTable = new DataTable(); SQLCon.sqlDataApater.Fill(SQLCon.dataTable); dataGridView_ListOfRequest.DataSource = SQLCon.dataTable; dataGridView_ListOfRequest.Columns["er_ID"].Visible = false; dataGridView_ListOfRequest.Columns["contactNo"].Visible = false; dataGridView_ListOfRequest.Columns["contactPerson"].Visible = false; dataGridView_ListOfRequest.Columns["pd_Solo"].Visible = false; dataGridView_ListOfRequest.Columns["pd_Duet"].Visible = false; dataGridView_ListOfRequest.Columns["pd_Chorale"].Visible = false; dataGridView_ListOfRequest.Columns["pd_RondallaBand"].Visible = false; dataGridView_ListOfRequest.Columns["pd_FolkDance"].Visible = false; dataGridView_ListOfRequest.Columns["pd_HipHop"].Visible = false; dataGridView_ListOfRequest.Columns["pd_Contemporary"].Visible = false; dataGridView_ListOfRequest.Columns["pd_DanceSports"].Visible = false; dataGridView_ListOfRequest.Columns["noOfPerformance"].Visible = false; dataGridView_ListOfRequest.Columns["noOfPerformer"].Visible = false; dataGridView_ListOfRequest.Columns["bitaw"].Visible = false; dataGridView_ListOfRequest.Columns["specify"].Visible = false; dataGridView_ListOfRequest.Columns["denied_Reason"].Visible = false; dataGridView_ListOfRequest.Columns["notedBy"].Visible = false; dataGridView_ListOfRequest.Columns["ApprovedBy"].Visible = false; label_Count.Text = dataGridView_ListOfRequest.RowCount.ToString(); }
public ControllerTextBausteine() { SQLCon con = new SQLCon(); TextBausteine bausteine = new TextBausteine(); con.CreateLanguage(); bausteine.Show(); }
private void loadPaymentRecords() { SQLCon.sqlDataAdapter = new SqlDataAdapter("SELECT PolicyNumberPayment AS [POLICY NO], PaidDate AS [DATE PAID], PaymentPaid AS [PAYMENT PAID] FROM PaymentRecords WHERE PolicyNumberPayment='" + dataGridView1.SelectedRows[0].Cells[1].Value.ToString() + "'", SQLCon.sqlConnection); //SQLCon.sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@1", "%" + lb_PolicyNo.Text + "%"); SQLCon.dbCon(); SQLCon.dataTable = new DataTable(); SQLCon.sqlDataAdapter.Fill(SQLCon.dataTable); dataGridView_PaymentRecordss.DataSource = SQLCon.dataTable; }
public override void InsertData(object o) { DBAllSize dbInfo = o as DBAllSize; if (dbInfo != null) { SQLCon.Insert(dbInfo); } }
public override void InsertData(object o) { ShopDBInformation shopInfo = o as ShopDBInformation; if (shopInfo != null) { SQLCon.Insert(shopInfo); } }
public AddServerBody() { InitializeComponent(); CertSQL.SQLCon a = new SQLCon(); a.DBConfig.Open(); a.SQLCMD = new SqlCommand("SELECT szModuleName FROM _Module", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Module.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.SQLCMD = new SqlCommand("SELECT nID FROM _ServerBody", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Certifier.Items.Add(a.SQLReader.GetInt16(0)); } a.SQLReader.Close(); a.SQLCMD = new SqlCommand("SELECT szName FROM _Division", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Division.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.SQLCMD = new SqlCommand("SELECT szName FROM _Farm", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Farm.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.SQLCMD = new SqlCommand("SELECT szName FROM _Shard", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Shard.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.SQLCMD = new SqlCommand("SELECT szName FROM _ServerMachine", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Machine.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.DBConfig.Close(); }
private void AddPayment() { SQLCon.dbCon(); SQLCon.sqlCommand = new SqlCommand("INSERT INTO PaymentRecords VALUES (@2, @3, @4)", SQLCon.sqlConnection); SQLCon.sqlCommand.CommandType = CommandType.Text; SQLCon.sqlCommand.Parameters.AddWithValue("@2", Int32.Parse(lb_SumInsurred.Text)); SQLCon.sqlCommand.Parameters.AddWithValue("@3", DateTime.Now.ToString()); SQLCon.sqlCommand.Parameters.AddWithValue("@4", lb_PolicyNo.Text); SQLCon.sqlCommand.ExecuteNonQuery(); }
public void GetDicShopInfo() { var temp = SQLCon.Query <ShopDBInformation>("select * from ShopDBInformation"); foreach (ShopDBInformation pInfo in temp) { if (!Data_ShopInfo.DIC_SHOP_DB_INFO_OVERALL_INFO.ContainsKey(pInfo.IdentificationNumber)) { Data_ShopInfo.DIC_SHOP_DB_INFO_OVERALL_INFO.Add(pInfo.IdentificationNumber, pInfo); } } }
public void PopulateComboBox(string tableName, string valueName, string displayName, ComboBox cb_Name) { SQLCon.DbCon(); SQLCon.sqlDataApater = new SqlDataAdapter("SELECT DISTINCT " + displayName + " FROM " + tableName + " ORDER BY " + displayName, SQLCon.sqlConnection); SQLCon.dataTable = new DataTable(); SQLCon.sqlDataApater.Fill(SQLCon.dataTable); cb_Name.DataSource = SQLCon.dataTable; // cb_Name.ValueMember = valueName; cb_Name.DisplayMember = displayName; cb_Name.AutoCompleteMode = AutoCompleteMode.Append; cb_Name.AutoCompleteSource = AutoCompleteSource.ListItems; cb_Name.SelectedIndex = -1; }
public int GetDBSize(string dbKind) { List <DBAllSize> tempSize = SQLCon.Query <DBAllSize>("select * from DBAllSize where DBName = ?", dbKind); try { dbSize = tempSize[0].DB_Num; } catch { return(0); } return(dbSize); }
private void button1_Click(object sender, EventArgs e) { if (Division.Text == "" || MachineName.Text == "" || PublicIP.Text == "" || PrivateIP.Text == "") { MessageBox.Show("Please fill in the machine data", "WARNING!!!"); } else { CertSQL.SQLCon a = new SQLCon(); a.DBConfig.Open(); object DivisionID = null; if (Division.Text == "") { DivisionID = 0; } else { a.SQLCMD = new SqlCommand("SELECT nID FROM _Division WHERE szName = '" + Division.Text + "'", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); a.SQLReader.Read(); DivisionID = a.SQLReader.GetSqlByte(0); a.SQLReader.Close(); } // EXEC _AddServerMachine @DivisionID, @MachineName, @PublicIP, @PrivateIP a.SQLCMD = new SqlCommand("_AddServerMachine", a.DBConfig); a.SQLCMD.CommandType = CommandType.StoredProcedure; if (MachineName.Text == "Certification") { a.SQLCMD.Parameters.Add("@DivisionID", SqlDbType.TinyInt).Value = 0; a.SQLCMD.Parameters.Add("@MachineName", SqlDbType.VarChar).Value = MachineName.Text; a.SQLCMD.Parameters.Add("@PublicIP", SqlDbType.VarChar).Value = "127.0.0.1"; a.SQLCMD.Parameters.Add("@PrivateIP", SqlDbType.VarChar).Value = "127.0.0.1"; } else { a.SQLCMD.Parameters.Add("@DivisionID", SqlDbType.TinyInt).Value = DivisionID; a.SQLCMD.Parameters.Add("@MachineName", SqlDbType.VarChar).Value = MachineName.Text; a.SQLCMD.Parameters.Add("@PublicIP", SqlDbType.VarChar).Value = PublicIP.Text; a.SQLCMD.Parameters.Add("@PrivateIP", SqlDbType.VarChar).Value = PrivateIP.Text; } a.SQLCMD.ExecuteNonQuery(); /// a.DBConfig.Close(); MessageBox.Show("Successfully added new Server Machine!\nMachine: " + MachineName.Text + "\nDivision: " + Division.Text + "\nWAN Address: " + PublicIP.Text + "\nLAN Address: " + PrivateIP.Text, "Success"); } }
// Start is called before the first frame update void Start() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } StartCoroutine(InternetControl()); level = PlayerPrefs.GetInt("Comp_Levels", 0); }
/// <summary> /// adds a folder to the list fo current folders /// </summary> /// <param name="path">foldername or path</param> public void AddFolder(string path) { using (SQLiteCommand fAdd = new SQLiteCommand(SQLCon)) { fAdd.CommandType = System.Data.CommandType.Text; fAdd.CommandText = "INSERT INTO FOLDERS (FOLDERNAME, CREATIONDATE) VALUES(@f, @c)"; fAdd.Parameters.AddWithValue("@f", (new System.IO.DirectoryInfo(path)).Name); fAdd.Parameters.AddWithValue("@c", System.IO.Directory.GetCreationTime(path)); SQLCon.Open(); fAdd.ExecuteNonQuery(); SQLCon.Close(); } WriteLog(path, "New folder added."); }
// GET: EditItem public ActionResult Index(int edit_id) { SqlConnection con = SQLCon.getConnection(); SqlCommand q = con.CreateCommand(); q.CommandType = CommandType.Text; q.CommandText = "SELECT * FROM [Category]"; SqlDataReader result = q.ExecuteReader(); List <Category> categories = new List <Category>(); while (result.Read()) { categories.Add(new Category { id = Int32.Parse(result["id"].ToString()), name = result["name"].ToString(), item_count = Int32.Parse(result["item_count"].ToString()) }); } result.Close(); q.CommandText = "SELECT TOP 1 [Category].name AS category_name, [Category].item_count AS category_item_count,[Item].* FROM [Item] LEFT JOIN [Category] ON [Item].category_id=[Category].id WHERE [Item].id='" + edit_id + "'"; result = q.ExecuteReader(); result.Read(); Item item = new Item { id = Int32.Parse(result["id"].ToString()), category = new Category { id = Int32.Parse(result["category_id"].ToString()), item_count = Int32.Parse(result["category_item_count"].ToString()), name = result["category_name"].ToString() }, userId = Int32.Parse(result["user_id"].ToString()), isSold = Int32.Parse(result["sold"].ToString()) == 1, price = Double.Parse(result["price"].ToString()), name = result["name"].ToString(), imageFile = result["imagefile"].ToString(), description = result["description"].ToString() }; ViewBag.item = item; ViewBag.categories = categories; return(View()); }
public AddFarm() { InitializeComponent(); CertSQL.SQLCon a = new SQLCon(); a.DBConfig.Open(); a.SQLCMD = new SqlCommand("SELECT szName FROM _Division", a.DBConfig); a.SQLReader = a.SQLCMD.ExecuteReader(); while (a.SQLReader.Read()) { Division.Items.Add(a.SQLReader.GetString(0)); } a.SQLReader.Close(); a.DBConfig.Close(); }
private void rptProposalCommon_DataSourceDemanded(object sender, EventArgs e) { try { dsDiscountCalculation ds = new dsDiscountCalculation(); this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter.ClearBeforeFill = true; this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter.Fill(ds.P_Rpt_QuerCalculation_DiscountPosition, dtValue, _PID, _Type, _LVSection); dsProposalCommon _dsCommon = new dsProposalCommon(); this.p_Rpt_PositionForProposalPriceForCommonTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_PositionForProposalPriceForCommonTableAdapter.ClearBeforeFill = true; this.p_Rpt_PositionForProposalPriceForCommonTableAdapter.Fill(_dsCommon.P_Rpt_PositionForProposalPriceForCommon, dtValue, _PID, _Type, _LVSection); dsProposalCommonTotalSummery _dsTotalSum = new dsProposalCommonTotalSummery(); this.p_Rpt_GetTotalSummeryTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_GetTotalSummeryTableAdapter.ClearBeforeFill = true; this.p_Rpt_GetTotalSummeryTableAdapter.Fill(_dsTotalSum.P_Rpt_GetTotalSummery, dtValue, _PID, _Type, _LVSection); DataTable dtdiscount = new DataTable(); dtdiscount = ds.P_Rpt_QuerCalculation_DiscountPosition; if (dtdiscount != null) { decimal _result = 0; if (decimal.TryParse(Convert.ToString(dtdiscount.Rows[0][0]), out _result)) { if (_result != 0) //&& !ISWithGB) { tbDiscount.Text = '-' + _result.ToString("n2"); _Discount = Convert.ToDouble(_result); } else { tbDiscount.Text = string.Empty; _Discount = 0; lblDiscount.Visible = false; lblDiscountEuro.Visible = false; } } } } catch (Exception ex) { Utility.ShowError(ex); } }