private void SaveData(string cmdType) { dsEmployee objDS = new dsEmployee(); DataTable dtMst = objDS.Tables["EmpPresentStatus"]; DataRow nRow = dtMst.NewRow(); nRow = Common.SetSingleTableFormData(nRow, this.Controls, Session["USERID"].ToString().Trim(), cmdType); if (cmdType == "I") { hdfStatusId.Value = Common.getMaxId("EmpPresentStatus", "StatusId"); } nRow["StatusId"] = Convert.ToDecimal(hdfStatusId.Value); dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); try { objEmpInfoMgr.SaveData(dtMst, cmdType == "D" ? "U" : cmdType); //SiteMaster.ShowClientMessage(Page, Common.GetMessage(cmdType), "success"); //Response.Redirect("~/Pages/EmpPresentStatus.aspx"); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static dsEmployee GetEmployee(string Database, string strSearch, string searchField) { // Initializing objects dsEmployee DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // assigning new OleDbConnection class to sqlConn object sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); int x = 0; if (strSearch == null || strSearch.Trim() == "") { sqlDA = new OleDbDataAdapter("select * from tblEmployee", sqlConn); } else { if (searchField == "ZipCode" || searchField == "Salary" || searchField == "UserID") { x = 10; sqlDA = new OleDbDataAdapter("select * from tblEmployee where " + searchField + " = " + strSearch, sqlConn); } else { x = 99; sqlDA = new OleDbDataAdapter("select * from tblEmployee where " + searchField + " = '" + strSearch + "'", sqlConn); } } // assigning new dsUserActivity class to DS object DS = new dsEmployee(); // fills sqlDA sqlDA.Fill(DS.tblEmployee); return(DS); }//end GetEmployee
private void CheckAwayDeskLog() { DataTable dtLog = objAM.getDeskAwayLog(Session["EMPID"].ToString().Trim(), "", ""); if (dtLog.Rows.Count > 0) { string cmdType; dsEmployee objDS = new dsEmployee(); DataTable dtMst = objDS.Tables["EmpAwayDeskLog"]; DataRow nRow = dtMst.NewRow(); nRow["SLNo"] = Int64.Parse(dtLog.Rows[0]["SLNO"].ToString().Trim()); nRow["EMPID"] = Session["EMPID"].ToString().Trim(); nRow["LogDate"] = DateTime.Now.ToShortDateString(); nRow["Reason"] = dtLog.Rows[0]["Reason"].ToString().Trim(); nRow["OutTime"] = dtLog.Rows[0]["OutTime"].ToString().Trim(); cmdType = "U"; nRow["InTime"] = DateTime.Now.ToShortTimeString(); dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); try { objEmpInfoMgr.SaveData(dtMst, cmdType == "D" ? "U" : cmdType); } catch (Exception ex) { throw new Exception(ex.Message); } } }
public override global::System.Data.DataSet Clone() { dsEmployee cln = ((dsEmployee)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
protected void FillDataList() { dsEmployee myDataSet = new dsEmployee(); //Fill the dataset with what is returned from the method. myDataSet = clsDataLayer.GetEmployee(Server.MapPath("TPS_Website_DB.accdb"), Request.QueryString["ID"], "UserID"); //Set the DataGrid to the DataSource based on the table DataList1.DataSource = myDataSet.Tables["tblEmployee"]; //Bind the DataGrid DataList1.DataBind(); }
protected void FillDataList() { dsEmployee myDataSet = new dsEmployee(); int strSearch = int.Parse(DropDownList1.SelectedValue.ToString()); //Fill the dataset with what is returned from the method. myDataSet = clsDataLayer.GetEmployee(Server.MapPath("TPS_Website_DB.accdb"), strSearch.ToString(), "EmployeeID"); //Set the DataGrid to the DataSource based on the table DataList1.DataSource = myDataSet.Tables["tblEmployee"]; //Bind the DataGrid DataList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { dsEmployee myDataSet = new dsEmployee(); string strSearch = Request["txtSearch"]; //Fill the dataset with what is returned from the method. myDataSet = clsDataLayer.GetEmployee(Server.MapPath("TPS_Website_DB.accdb"), strSearch, null); //Set the DataGrid to the DataSource based on the table DataList1.DataSource = myDataSet.Tables["tblPersonnel"]; //Bind the DataGrid DataList1.DataBind(); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { dsEmployee ds = new dsEmployee(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
//populates a dataset with information from the Employee Table public dsEmployee findEmployee(int employeeID) { //create an SQL query that returns employees with a specific employeeID string sqlStmt = "select * from Employee where employeeID like '" + employeeID + "'"; OleDbDataAdapter sqlDataAdapter = new OleDbDataAdapter(sqlStmt, dbConnection); dsEmployee tempDataSet = new dsEmployee(); sqlDataAdapter.Fill(tempDataSet.Employee); //returns the resulting data set -- should be only up to 1 line return(tempDataSet); }
protected void btnSearch_Click(object sender, EventArgs e) { dsEmployee myDataSet = new dsEmployee(); string strSearch = Request["txtSearch"]; string searchField = ddlSearch.SelectedValue.ToString(); //Fill the dataset with what is returned from the method. myDataSet = clsDataLayer.GetEmployee(Server.MapPath("TPS_Website_DB.accdb"), strSearch, searchField); //Set the DataGrid to the DataSource based on the table GridView2.DataSource = myDataSet.Tables["tblEmployee"]; //Bind the DataGrid GridView2.DataBind(); }
//populates a dropDownMenu with all Employees from the Employee Table public dsEmployee dsEmployeeDropDown() { //this SQL query creates a table called Employee with 2 columns //Column 1: contains the Employee's ID //Column 2: contains the Employee's ID number: LastName, and FirstName string sqlStmt = "Select EmployeeID, EmployeeID & ': ' & lastName & ', ' & FirstName AS Employee FROM Employee"; OleDbDataAdapter sqlDataAdapter = new OleDbDataAdapter(sqlStmt, dbConnection); dsEmployee tempDataSet = new dsEmployee(); sqlDataAdapter.Fill(tempDataSet.Employee); //returns the resulting data set -- this list should be expected to have many rows return(tempDataSet); }
protected void Page_Load(object sender, EventArgs e) { GridView1.Visible = false; if (Session["SecurityLevel"] == null) { Response.Redirect("~/frmLogin.aspx"); } if (!IsPostBack) { dsEmployee myDataSet = new dsEmployee(); myDataSet = clsDataLayer.GetEmployee(Server.MapPath("TPS_Website_DB.accdb"), null, null); //Set the DataGrid to the DataSource based on the table GridView2.DataSource = myDataSet.Tables["tblEmployee"]; //Bind the DataGrid GridView2.DataBind(); } }
private void SaveData() { string cmdType; dsEmployee objDS = new dsEmployee(); DataTable dtMst = objDS.Tables["EmpAwayDeskLog"]; DataRow nRow = dtMst.NewRow(); if (hdfSINO.Value == string.Empty) { cmdType = "I"; hdfSINO.Value = Common.getMaxIdVar("EmpAwayDeskLog", "SLNo"); nRow["OutTime"] = DateTime.Now.ToShortTimeString(); } else { cmdType = "U"; nRow["InTime"] = DateTime.Now.ToShortTimeString(); nRow["OutTime"] = hdfOutTime.Value.ToString().Trim(); } nRow["SLNo"] = Int64.Parse(hdfSINO.Value); nRow["EMPID"] = Session["EMPID"].ToString().Trim(); nRow["LogDate"] = DateTime.Now.ToShortDateString(); nRow["Reason"] = txtReason.Text.Trim(); dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); try { objEmpInfoMgr.SaveData(dtMst, cmdType == "D" ? "U" : cmdType); SiteMaster.ShowClientMessage(Page, Common.GetMessage(cmdType), "success"); this.OpenRecord(); } catch (Exception ex) { throw new Exception(ex.Message); } }
private void SaveData(string cmdType) { dsEmployee objDS = new dsEmployee(); DataTable dtMst = objDS.Tables["EmpInfo"]; DataRow nRow = dtMst.NewRow(); nRow = Common.SetSingleTableFormData(nRow, this.Controls, Session["USERID"].ToString().Trim(), cmdType); dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); try { objEmpInfoMgr.SaveData(dtMst, cmdType == "D" ? "U" : cmdType); SiteMaster.ShowClientMessage(Page, Common.GetMessage(cmdType), "success"); this.RefreshForm(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void populateDropDownList(int sValue) { try { dsEmployee dsPopulate = new dsEmployee(); string tempPath = Server.MapPath("~/HTVDatabase1.mdb"); clsDataLayer dataLayerObj = new HTV.clsDataLayer(tempPath); dsPopulate = dataLayerObj.dsEmployeeDropDown(); ddlEmployeeID.DataSource = dsPopulate; ddlEmployeeID.DataTextField = "Employee"; ddlEmployeeID.DataValueField = "employeeID"; ddlEmployeeID.DataBind(); //this is the that selects the item that was passed to the method (by value) ddlEmployeeID.SelectedValue = sValue.ToString(); } catch (Exception error) { Warnings.Text = "Critical Error: " + error; } }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); dsEmployee ds = new dsEmployee(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "dsEmployeeDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public virtual int Fill(dsEmployee.tblEmployeeDataTable dataTable, global::System.Nullable<int> nDepartment) { this.Adapter.SelectCommand = this.CommandCollection[0]; if ((nDepartment.HasValue == true)) { this.Adapter.SelectCommand.Parameters[0].Value = ((int)(nDepartment.Value)); } else { this.Adapter.SelectCommand.Parameters[0].Value = global::System.DBNull.Value; } if ((this.ClearBeforeFill == true)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); return returnValue; }
private void SaveData(string cmdType) { if (this.ValidateAndSave(cmdType) == false) { return; } dsEmployee objDS = new dsEmployee(); if (cmdType == "I") { hfID.Value = Common.getMaxId("Nominee", "NomineeId"); } DataTable dtMst = objDS.Tables["Nominee"]; DataRow nRow = dtMst.NewRow(); nRow["NomineeId"] = Common.RoundDecimal(hfID.Value, 0); nRow["EmpID"] = txtEmpId.Text.Trim(); nRow["NomineeName"] = txtNomineeName.Text.Trim(); nRow["RelationId"] = Convert.ToDecimal(ddlRelation.SelectedValue.ToString().Trim()); //nRow["DOB"] =Common.ReturnDateTime(Common.DisplayDateTime(txtDOB.Text.Trim(),false, Constant.strDateFormat), false, Constant.strDateFormat); nRow["DOB"] = Common.ReturnDateTime(txtDOB.Text.Trim(), false, Constant.strDateFormat); nRow["Gender"] = ddlGender.SelectedValue.ToString().Trim(); nRow["IsMedical"] = "N"; nRow["IsDeath"] = "N"; nRow["Share"] = 0; if (cblNomTypeList.Items.FindByValue("M").Selected == true) { nRow["IsMedical"] = "Y"; } if (cblNomTypeList.Items.FindByValue("D").Selected == true) { nRow["IsDeath"] = "Y"; nRow["Share"] = txtShare.Text.Trim(); } nRow["Address"] = txtAddress.Text.Trim(); nRow["Remarks"] = txtRemarks.Text.Trim(); if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; nRow["LastUpdatedFrom"] = Session["USERID"].ToString().Trim(); } nRow["IsDeleted"] = (cmdType == "D" ? "Y" : "N"); dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); try { objEmpInfoMgr.SaveData(dtMst, cmdType == "D" ? "U" : cmdType); SiteMaster.ShowClientMessage(Page, Common.GetMessage(cmdType), "success"); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { dsEmployee ds = new dsEmployee(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public virtual int Update(dsEmployee.tblEmployeeDataTable dataTable) { return this.Adapter.Update(dataTable); }
private void SaveData(string cmdType) { dsEmployee objDS = new dsEmployee(); if (cmdType == "I") { hfID.Value = Common.getMaxId("EmpFamilyInfo", "FmID"); } DataTable dtMst = objDS.Tables["EmpFamilyInfo"]; DataRow nRow = dtMst.NewRow(); string msg = "saved"; nRow["EmpID"] = txtEmpId.Text.Trim(); nRow["FmID"] = Common.RoundDecimal(hfID.Value, 0); nRow["FmName"] = txtName.Text.Trim(); nRow["FmAddr"] = txtAddress.Text.Trim(); nRow["FmPhone"] = txtPhone.Text.Trim(); nRow["RelationId"] = Convert.ToDecimal(ddlRelation.SelectedValue.ToString().Trim()); if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; nRow["LastUpdatedFrom"] = Session["USERID"].ToString().Trim(); msg = "updated"; } if (cmdType == "D") { nRow["IsDeleted"] = "Y"; msg = "deleted"; } else { nRow["IsDeleted"] = "N"; } dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); try { objDAL.SaveDataTable(dtMst, cmdType == "D" ? "U" : cmdType); SiteMaster.ShowClientMessage(Page, "Data " + msg + " successfully!", "success"); //SiteMaster.ShowToastr(Page, msg, msg); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); dsEmployee ds = new dsEmployee(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "tblEmployeeDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public virtual int Update(dsEmployee dataSet) { return this.Adapter.Update(dataSet, "tblEmployee"); }