protected void Page_Load(object sender, EventArgs e) { try { if (!User.Identity.IsAuthenticated) { Response.Redirect("../Login.aspx", false); } if (Session["user"] != null) { usr = (User)Session["user"]; } else { Response.Redirect("../Login.aspx", false); return; } if (!IsPostBack) { BindDept(); BindStatusList(); BindVehList(); BindLocation(); string sdate = DateTime.Now.AddDays(3).ToShortDateString(); string edate = DateTime.Now.ToShortDateString(); DBAccess db = new DBAccess(); db.AddParameter("@fromDate", DateTime.Now.AddDays(3)); db.AddParameter("@toDate", DateTime.Now); // db.AddParameter("@orderType",DBNull.Value.ToString()); // db.AddParameter("@solID", DBNull.Value.ToString()); rpt = new ReportParameter[2]; rpt[0] = new ReportParameter("paraFrom", sdate); rpt[1] = new ReportParameter("paraTo", edate); DataSet ds = new DataSet(); ds = db.ExecuteDataSet("FMS_TripReport"); ReportDataSource datasource = new ReportDataSource("dsFMS", ds.Tables[0]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.SetParameters(rpt); ReportViewer1.LocalReport.DataSources.Add(datasource); if (ds.Tables[0].Rows.Count == 0) { // lbmsg.Text = "Sorry, no products under this category!"; } ReportViewer1.LocalReport.Refresh(); return; } } catch (Exception ex) { } }
//CREATE TABLE [vicjos1_sysadm].[Co2Db_Medarbejder]( // [ID] [int] IDENTITY(1,1) NOT NULL, // [mgID] [int] NULL, // [CompanyID] [int] NULL, // [status] [int] NULL CONSTRAINT [DF_Co2Db_Medarbejder_status] DEFAULT ((1)), // [Cprnr] [nvarchr](10) NULL, // [Navn] [nvarchar](100) NULL, // [Adresse1] [nvarchar](100) NULL, // [Adresse2] [nvarchar](100) NULL, // [Postnr] [nvarchar](10) NULL, // [Bynavn] [nvarchar](50) NULL, // [LandID] [int] NULL, // [Telefon] [nvarchar](16) NULL, // [Mobil] [nvarchar](16) NULL, // [Fax] [nvarchar](16) NULL, // [Email] [nvarchar](250) NULL, // [HospitalsforsikringIndmeldsDato] [datetime] NULL, // [AfkaldserklaringsDato] [datetime] NULL, // [FratradelsesDato] [datetime] NULL, // [OrlovStart] [datetime] NULL, // [OrlovSlut] [datetime] NULL, // [RettetAf] [nvarchar](50) NULL, // [RettetDen] [datetime] NULL CONSTRAINT [DF_Co2Db_Medarbejder_RettetDen] DEFAULT (getdate()), // [RettetIP] [nvarchar](15) NULL public static DataSet SearchMedarbejder(int mgCompanyID, string navn) { string[] arr = navn.Split(' '); DataSet ds = new DataSet(); DataSet dsTemp = new DataSet(); bool flag = false; DBAccess db = new DBAccess(); foreach (string s in arr) { db.AddParameter("@mgCompanyID", mgCompanyID); db.AddParameter("@Search", s); dsTemp = db.ExecuteDataSet("Co2Db_Medarbejder_SelectBySearch"); db.Parameters.Clear(); ds.Merge(dsTemp); if (flag == false) { DataColumn[] pk = new DataColumn[2]; pk[0] = ds.Tables[0].Columns["ID"]; ds.Tables[0].PrimaryKey = pk; flag = true; } } return(ds); }
// SELECT ID, mgNavn, mgCompanyID, Cvrnr, Firmanavn, // medID, medCompanyID, Cprnr, Navn, Adresse1, Adresse2, Postnr, Bynavn, Land, Telefon, Mobil, Fax, // Email, HospitalsforsikringIndmeldsDato, AfkaldserklaringsDato, FratradelsesDato, OrlovStart, OrlovSlut // FROM vw_Co2Db_MedarbejderGruppe_Medarbejder public static DataSet SearchMedarbejderFliter(int mgCompanyID, int mgID, int Forsikring, int Status, DateTime dato) { //Dim arr As String() = search.Split(" "c) DataSet ds = new DataSet(); DataSet dsTemp = new DataSet(); bool flag = false; DBAccess db = new DBAccess(); //For Each s As String In arr db.AddParameter("@mgCompanyID", mgCompanyID); db.AddParameter("@mgID", mgID); db.AddParameter("@forsikring", Forsikring); db.AddParameter("@status", Status); if (Information.IsDate(dato)) { if (dato != new DateTime(2018, 8, 6)) { db.AddParameter("@dato", dato); } } dsTemp = db.ExecuteDataSet("Co2Db_Medarbejder_SelectFilter"); db.Parameters.Clear(); ds.Merge(dsTemp); if (flag == false) { DataColumn[] pk = new DataColumn[2]; pk[0] = ds.Tables[0].Columns["medID"]; ds.Tables[0].PrimaryKey = pk; flag = true; } //Next return(ds); }
//protected void ChangePassword1_ChangingPassword(object sender, EventArgs e) //{ // DBAccess ChangePassword = new DBAccess(); // ChangePassword.CommandText = "ChangePassword"; // ChangePassword.AddParameter("@LoginID", Session["LoginID"]); // ChangePassword.AddParameter("@LoginName", Session["LoginName"]); // ChangePassword.AddParameter("@OldPassword", PasswordUtils.encode(ChangePassword1.CurrentPassword.ToString())); // ChangePassword.AddParameter("@NewPassword", PasswordUtils.encode(ChangePassword1.NewPassword.ToString())); // SqlParameter Exist = new SqlParameter(); // Exist.Direction = ParameterDirection.Output; // Exist.SqlDbType = SqlDbType.Int; // Exist.Size = 4; // Exist.ParameterName = "@Exist"; // ChangePassword.AddParameter(Exist); // ChangePassword.ExecuteNonQuery(); // if (Exist.Value.Equals(null) || Exist.Value.Equals(0)) // ChangePassword1.ChangePasswordFailureText = "Old Password is incorrect. Please Try Again."; // else // { // ChangePassword1.SuccessText = "Password Changed."; // ChangePassword1.ChangePasswordFailureText = "Password Changed"; // } // return; //} protected void ChangePassword1_ChangingPassword(object sender, EventArgs e) { if ((ChangePassword1.NewPassword.Length < 6) || (ChangePassword1.ConfirmNewPassword.Length < 6)) { ChangePassword1.ChangePasswordFailureText = "Password must be at least 6 characters long."; return; } else { if (ChangePassword1.CurrentPassword == Session["OldPassword"].ToString()) { DBAccess ChangePassword = new DBAccess(); ChangePassword.CommandText = "ChangePassword"; ChangePassword.AddParameter("@LoginID", Session["LoginID"]); ChangePassword.AddParameter("@LoginName", Session["LoginName"]); ChangePassword.AddParameter("@NewPassword", PasswordUtils.encode(ChangePassword1.NewPassword.ToString())); ChangePassword.ExecuteNonQuery(); ChangePassword1.ChangePasswordFailureText = "Password Changed"; } else { ChangePassword1.ChangePasswordFailureText = "Old Password is Incorrect. Try again."; } } return; }
public static DataSet Search_Dokumenter_Forsikringer(string navn, int Type, int Category = -1, int Owner = -1, int MedArbGrpID = -1) { string[] arr = navn.Split(' '); DataSet ds = new DataSet(); DataSet dsTemp = new DataSet(); bool flag = false; DBAccess db = new DBAccess(); foreach (string s in arr) { db.AddParameter("@Type", Type); db.AddParameter("@Category", Category); db.AddParameter("@Owner", Owner); db.AddParameter("@MedArbGrpID", MedArbGrpID); db.AddParameter("@Search", s); //vw_Co2Db_Dokumenter_Forsikringer dsTemp = db.ExecuteDataSet("Co2Db_Dokumenter_Forsikring_SelectBySearch"); db.Parameters.Clear(); ds.Merge(dsTemp); if (flag == false) { DataColumn[] pk = new DataColumn[2]; pk[0] = ds.Tables[0].Columns["ID"]; ds.Tables[0].PrimaryKey = pk; flag = true; } } return(ds); }
public static int Update(ExperienceLevel l) { DBAccess db = new DBAccess(); db.AddParameter("@iExperienceLevelID", l.ExperienceLevelID); db.AddParameter("@sExperienceLevelName", l.ExperienceLevelName); return(db.ExecuteNonQuery("JobsDb_ExperienceLevels_Update")); }
public int UpdateCountry(Country c) { DBAccess db = new DBAccess(); db.AddParameter("@iCountryID", c.CountryID); db.AddParameter("@sCountryName", c.CountryName); return(db.ExecuteNonQuery("JobsDb_Countries_Update")); }
public static int SysParmDelete(string Param) { DBAccess db = new DBAccess(); db.AddParameter("@ApplicationName", SQLfunctions.SQLstr(Roles.ApplicationName)); db.AddParameter("@Title", Param); return(db.ExecuteNonQuery("Co2Db_SysParm_Delete")); }
public static string GetByNavn(string Postnr, int LandID = 1) { DBAccess db = new DBAccess(); db.AddParameter("@Postnr", Postnr); db.AddParameter("@Land", LandID); return(System.Convert.ToString(db.ExecuteScalar("Co2Db_Postnr_SelectBynavn"))); }
public static void set_SysParm(string Param, string value) { DBAccess db = new DBAccess(); db.AddParameter("@ApplicationName", SQLfunctions.SQLstr(Roles.ApplicationName)); db.AddParameter("@Title", SQLfunctions.SQLstr(Param)); db.AddParameter("@Value", SQLfunctions.SQLstr(value)); db.ExecuteNonQuery("Co2Db_Sysparm_Update"); }
public static void eliminar_Experiencia(Experiencia exp) { DBAccess oDb = new DBAccess(); oDb.AddParameter("@num", exp._num); oDb.AddParameter("@num_dni", exp._num_dni); oDb.ExecuteNonQuery("sp_Experiencia_delete"); }
public int InserttblSubCategory() { DBAccess db = new DBAccess(); db.AddParameter("@sSubCatName", sSubCatName); db.AddParameter("@sImagePath", sImagePath); db.AddParameter("@iCategoryId", iCategoryId); db.AddParameter("@sDescription", sDescription); db.AddParameter("@decPrice", decPrice); return db.ExecuteNonQuery("[tblSubCategory_Insert]", true); }
public static int GetIndexByTitle(string Field, string Title) { DBAccess db = new DBAccess(); db.AddParameter("@Field", Field); db.AddParameter("@Title", Title); int res = Funktioner.ToInt(db.ExecuteScalar(_SQLSelectGetIdxByTitle)); //"Co2Db_Combobox_GetIdxByTitle" return(res); }
public int InsertCountry(Country c) { DBAccess db = new DBAccess(); SqlParameter p = new SqlParameter("@iCountryID", 0); p.Direction = ParameterDirection.Output; db.AddParameter("@sCountryName", c.CountryName); db.AddParameter(p); return(db.ExecuteNonQuery("JobsDb_Countries_Insert")); }
protected void btnGenerate_Click(object sender, EventArgs e) { try { lbMsg.Text = ""; int byrID = int.Parse(ddlbudyr.SelectedValue); DBAccess db = new DBAccess(); db.AddParameter("budgetYrId", byrID); rpt = new ReportParameter[3]; //rpt[2] = new ReportParameter("dirID", "1"); rpt[2] = new ReportParameter("status", "0"); rpt[1] = new ReportParameter("deptID", "1"); rpt[0] = new ReportParameter("budgetYrID", byrID.ToString()); if (ddlDept.SelectedValue != "") { rpt[1] = new ReportParameter("deptID", ddlDept.SelectedValue); db.AddParameter("@deptId", int.Parse(ddlDept.SelectedValue)); } if (ddlStatus.SelectedValue != "") { rpt[2] = new ReportParameter("status", ddlStatus.SelectedValue); db.AddParameter("@status", int.Parse(ddlStatus.SelectedValue)); } //if (ddlDir.SelectedValue != "") //{ // rpt[2] = new ReportParameter("dirID", ddlDir.SelectedValue); // db.AddParameter("@directorateID", int.Parse(ddlDir.SelectedValue)); //} DataSet ds = new DataSet(); ds = db.ExecuteDataSet("bc_rpt_Movable"); ReportDataSource datasource = new ReportDataSource("dsBudget", ds.Tables[0]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.SetParameters(rpt); ReportViewer1.LocalReport.DataSources.Add(datasource); if (ds.Tables[0].Rows.Count == 0) { lbMsg.Text = "Sorry, No record found!"; } ReportViewer1.LocalReport.Refresh(); return; } catch (Exception ex) { lbMsg.Text = ex.Message; } }
protected void btnGenerate_Click(object sender, EventArgs e) { try { lbMsg.Text = ""; string sdate = txtvsrt.Text; string edate = txtvstp.Text; DateTime sdate1 = DateTime.Parse(sdate, culture); DateTime edate1 = DateTime.Parse(edate, culture); DBAccess db = new DBAccess(); rpt = new ReportParameter[4]; rpt[2] = new ReportParameter("TypeId", "1"); rpt[3] = new ReportParameter("locationId", "1"); db.AddParameter("@fromDate", sdate1); db.AddParameter("@toDate", edate1); if (ddlType.SelectedValue != "") { db.AddParameter("@IncidenceType", ddlType.SelectedValue); rpt[2] = new ReportParameter("TypeId", ddlType.SelectedValue); } if (ddlLocation.SelectedValue != "") { db.AddParameter("@LocationID", ddlLocation.SelectedValue); rpt[1] = new ReportParameter("locationId", ddlLocation.SelectedValue); } rpt[0] = new ReportParameter("paraFrom", sdate1.ToShortDateString()); rpt[1] = new ReportParameter("paraTo", edate1.ToShortDateString()); DataSet ds = new DataSet(); ds = db.ExecuteDataSet("FMS_VehicleLogReport"); ReportDataSource datasource = new ReportDataSource("dsFMS", ds.Tables[0]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.SetParameters(rpt); ReportViewer1.LocalReport.DataSources.Add(datasource); if (ds.Tables[0].Rows.Count == 0) { lbMsg.Text = "Sorry, no record found!"; } ReportViewer1.LocalReport.Refresh(); } catch (Exception ex) { lbMsg.Text = "An error occurred: " + ex.Message; } }
public static void ComputeBudgetSummaryNewHire(int budyrID, int deptID) { try { DBAccess db = new DBAccess(); db.AddParameter("budgetYrId", budyrID); db.AddParameter("deptId", deptID); db.ExecuteNonQuery("bc_ComputeBudgetSummary_NewHire"); return; }catch (Exception ex) { throw ex; } }
//save status protected void SaveStatus(int StatusCode) { DBAccess RoyaltyReportStatus = new DBAccess(); RoyaltyReportStatus.CommandText = "RoyaltyReportStatus"; RoyaltyReportStatus.AddParameter("@LoginID", Session["LoginID"]); RoyaltyReportStatus.AddParameter("@CustomerID", Session["CustomerID"]); RoyaltyReportStatus.AddParameter("@ReportMonth", Convert.ToInt32(Session["ReportMonth"])); RoyaltyReportStatus.AddParameter("@ReportYear", Convert.ToInt32(Session["ReportYear"])); //submitted = 2 RoyaltyReportStatus.AddParameter("@ReportStatusID", StatusCode); RoyaltyReportStatus.ExecuteNonQuery(); }
public static string GetContent(string Field, int idx) { DBAccess db = new DBAccess(); db.AddParameter("@Field", Field); db.AddParameter("@Idx", idx); string res = Funktioner.ToDbString(db.ExecuteScalar(_SQLSelectGetContent)); //"Co2Db_Combobox_GetContent" if (res.Trim().Length < 1) { res = " "; } return(res); }
public static string GetValueByTitle(string Field, string Title) { DBAccess db = new DBAccess(); db.AddParameter("@Field", Field); db.AddParameter("@Title", Title); string res = Funktioner.ToDbString(db.ExecuteScalar(_SQLSelectGetValueByTitle)); //"Co2Db_Combobox_GetValueByTitle" if (res.Trim().Length < 1) { res = " "; } return(res); }
public static Combobox GetCombobox(string Field, int idx) { int ID = -1; DBAccess db = new DBAccess(); db.AddParameter("@Field", Field); db.AddParameter("@Idx", idx); string res = Funktioner.ToDbString(db.ExecuteScalar(_SQLSelectOne)); //"Co2Db_Combobox_SelectOne" if (Information.IsNumeric(res)) { ID = Funktioner.ToInt(res); } return(GetCombobox(ID)); }
public static DataSet GetMyResumes(string username) { DBAccess db = new DBAccess(); db.AddParameter("@sUserName", username); return(db.ExecuteDataSet("JobsDb_MyResumes_SelectForUser")); }
public static int Delete(MyResume r) { DBAccess db = new DBAccess(); db.AddParameter("@iMyResumeID", r.MyResumeID); return(db.ExecuteNonQuery("JobsDb_MyResumes_Delete")); }
public static DataSet GetStates(int countryid) { DBAccess db = new DBAccess(); db.AddParameter("@iCountryID", countryid); return(db.ExecuteDataSet("JobsDb_States_SelectForCountry")); }
public static string GetMedarbejderName(int ID) { DBAccess db = new DBAccess(); db.AddParameter("@ID", ID); return(System.Convert.ToString(db.ExecuteScalar("Co2Db_Medarbejder_SelectName"))); }
public static string GetCountryName(int id) { DBAccess db = new DBAccess(); db.AddParameter("@iCountryID", id); return(db.ExecuteScalar("JobsDb_Countries_GetCountryName").ToString()); }
public static string GetStateName(int id) { DBAccess db = new DBAccess(); db.AddParameter("@iStateID", id); return(db.ExecuteScalar("JobsDb_States_GetStateName").ToString()); }
public static string GetCountryName(int ID) { DBAccess db = new DBAccess(); db.AddParameter("@iCountryID", ID); // return(db.ExecuteScalar("Co2Db_Dokumenter_GetCountryName").ToString()); }
//Postnr nvarchar(10), //Bynavn nvarchar(50), //Gade nvarchar(50), //Firma nvarchar(50), //Provins bit, //Land int public static DataSet SearchPostnrListe(string search) { string[] arr = search.Split(' '); DataSet ds = new DataSet(); DataSet dsTemp = new DataSet(); bool flag = false; DBAccess db = new DBAccess(); foreach (string s in arr) { db.AddParameter("@Search", s); dsTemp = db.ExecuteDataSet("Co2Db_Postnr_Search"); db.Parameters.Clear(); ds.Merge(dsTemp); if (flag == false) { DataColumn[] pk = new DataColumn[2]; pk[0] = ds.Tables[0].Columns["ID"]; ds.Tables[0].PrimaryKey = pk; flag = true; } } return(ds); }
public DataSet CategoryByCatId() { DBAccess db = new DBAccess(); db.AddParameter("@iCategoryId", iCategoryId); return db.ExecuteDataSet("tblCategory_SelectAllCat"); }