/// Create DataBase Backup File /// </summary> /// <param name="str_DBBackupName">String str_DBBackupName for retrieving</param> /// <param name="str_DBBackupFilePath">String str_DBBackupFilePath for retrieving</param> /// <returns></returns> public int CreateDBBackupFile(DEDataBackUp DataBackUp) { // Create an instance of BrowserInfo's data access component DALDataBackUp obj_DALDataBackUp = new DALDataBackUp(); // Read from database int int_Result = obj_DALDataBackUp.CreateDBBackupFile(DataBackUp); // Cleanup the resources used obj_DALDataBackUp = null; // Return from function return(int_Result); }
/// <summary> /// insert one record into tbl_User table /// </summary> /// <param name="DEUser">DEUser contains data for saving </param> /// <returns>return the integer that Prefix a value indicating whether record is executed successfully.</returns> public int CreateDBBackupFile(DEDataBackUp DataBackUp) { // Get a parameter array the values SqlParameter[] ParamVariable = DeclareStoreParameter(); // Set assign the values AssignStoreParameter(DataBackUp, ParamVariable); // Set the action value to 5 to delete the record // ParamVariable[0].Value =0; // Execute the sql command and assign the output value int int_Result = SqlHelper.ExecuteNonQuery("sp_DBBackup", CommandType.StoredProcedure, ParamVariable); // Cleanup the resources used ParamVariable = null; // Return from function return(int_Result); }
private void btnBackUp_Click(object sender, EventArgs e) { if (str_Name != string.Empty) { DEDataBackUp DataBackUp = new DEDataBackUp(); BLLDataBackUp obj_BLLDataBackUp = new BLLDataBackUp(); try { // Set Minimum to 1 to represent the first file being copied. ProBar.Minimum = 1; // Set Maximum to the total number of Users created. ProBar.Maximum = 4; // Set the initial value of the ProgressBar. ProBar.Value = 1; // Set the Step property to a value of 1 to represent each user is being created. ProBar.Step = 1; ProBar.PerformStep(); DataBackUp.DBBackUpName = ConfigurationManager.AppSettings.Get("DBBackUpName"); DataBackUp.DBBackupFilePath = str_Name + "\\" + DateTime.Today.ToLongDateString() + "StockAndSale.bak"; int int_Result = obj_BLLDataBackUp.CreateDBBackupFile(DataBackUp); ProBar.PerformStep(); label9.Visible = true; label9.Text = "Data Backup is Successfully Saved In" + " " + DataBackUp.DBBackupFilePath; label9.ForeColor = System.Drawing.Color.Blue; ProBar.Maximum = 3; } catch (Exception ex) { label9.Visible = true; label9.Text = ex.Message; label9.ForeColor = System.Drawing.Color.Red; } finally { obj_BLLDataBackUp = null; } } else { label9.Visible = true; label9.Text = "Choose Folder Name"; label9.ForeColor = System.Drawing.Color.Red; } }
/// <summary> /// Assign the parameter values with the data from object. /// </summary> /// <param name="UserData">Object containing data</param> /// <param name="ParameterArray">Parameter array to set the values</param> private void AssignStoreParameter(DEDataBackUp DataBackUp, SqlParameter[] ParamVariable) { ParamVariable[0].Value = DataBackUp.DBBackUpName; ParamVariable[1].Value = DataBackUp.DBBackupFilePath; }