/// <summary> /// This function populates the combo boxes /// </summary> private void PopulateComboBoxes() { ClsGeneral lgeneral = new ClsGeneral(); //Populate the ddlAssignedTo drop down ddlAssignedTo.DataSource = lgeneral.FetchControlData(ClsGeneral.ControlName.AssignedTo); ddlAssignedTo.DisplayMember = "FullName"; ddlAssignedTo.ValueMember = "EMP_LANID"; //Populate ddlOrgType dropdown ddlOrgType.DataSource = lgeneral.FetchControlData(ClsGeneral.ControlName.OrganizationType); ddlOrgType.DisplayMember = "LOOKUP_DESC"; ddlOrgType.ValueMember = "LOOKUP_ID"; //Populate cmbOrgProvince dropdown cmbOrgProvince.DataSource = lgeneral.FetchControlData(ClsGeneral.ControlName.OrganizationProvince); cmbOrgProvince.DisplayMember = "LOOKUP_DESC"; cmbOrgProvince.ValueMember = "LOOKUP_ID"; //Populate cmbPayProvince combobox cmbPayProvince.DataSource = lgeneral.FetchControlData(ClsGeneral.ControlName.PayableProvince); cmbPayProvince.DisplayMember = "LOOKUP_DESC"; cmbPayProvince.ValueMember = "LOOKUP_ID"; //Populate RequestTypeCombo combobox cmbRequestType.DataSource = lgeneral.FetchControlData(ClsGeneral.ControlName.RequestType); cmbRequestType.DisplayMember = "LOOKUP_DESC"; cmbRequestType.ValueMember = "LOOKUP_ID"; }
protected void ddlBaseLocation_SelectedIndexChanged(object sender, EventArgs e) { if (ddlBaseLocation.SelectedIndex != 0) { DataSet dsblcn = new DataSet(); dsblcn = (DataSet)ViewState["ContactNumber"]; DataView dv = new DataView(dsblcn.Tables[0], "Location_ID =" + Convert.ToInt32(ddlBaseLocation.SelectedItem.Value), "Contact_Number", DataViewRowState.CurrentRows); txtContactNumber.Text = dv[0]["Contact_Number"].ToString(); txtLatitude.Text = dv[0]["latitude"].ToString(); txtLongitude.Text = dv[0]["longitude"].ToString(); ClsGeneral csg = new ClsGeneral(); DataTable dtVehData = new DataTable(); dtVehData = csg.getVehiclesinRadius(txtLatitude.Text, txtLongitude.Text, ConfigurationSettings.AppSettings["Locateveh"].ToString()); if (dtVehData.Rows.Count > 0) { lblVeh.Text = "Vehicles that are under " + ConfigurationSettings.AppSettings["Locateveh"].ToString() + "KMs to base location "; grdVehicleData.DataSource = dtVehData; grdVehicleData.DataBind(); } } else { txtContactNumber.Text = ""; txtLatitude.Text = ""; txtLongitude.Text = ""; } }
public Boolean DuplicateChacking(string TblName, string FieldName, string Value, string MasterFeild, int MasterId) { try { if (FieldName.Trim().Length > 0) { string Qry = "select " + FieldName + " from " + TblName + " where " + FieldName + "='" + Value.SqlEncode() + "' and " + MasterFeild + " <> " + MasterId + ""; if (GetDataTable(Qry).Rows.Count > 0) { return(true); } else { return(false); } } else { return(false); } } catch (Exception ex) { ClsGeneral.ShowMessage(ex.Message); return(false); } }
protected void btnlogin_Click(object sender, EventArgs e) { try { // Valida que el usuario y password no esten vacios if (txtUsuario.Text != "" && txtPwd.Text != "") { // Retorna información del usuario y nivel acceso ClsAcceso objAcceso = new ClsAcceso(); string strPwd = new ClsGeneral().Encriptar(txtPwd.Text); DataTable dtbUsuario = objAcceso.RetornarLogin(txtUsuario.Text, strPwd); if (dtbUsuario.Columns.Contains(Constantes.ColumnaErrorLogin)) { lblErrorLogin.Text = dtbUsuario.Rows[0][1].ToString(); } else { lblErrorLogin.Text = string.Empty; Session[Constantes.IdSession] = Session.SessionID; Session[Constantes.TablaLogin] = dtbUsuario; //Response.Redirect("~/reportes"); Response.Redirect("~/horarios"); } } else { lblErrorLogin.Text = Constantes.MensajeErrorLoginVacios; } } catch (Exception) { lblErrorLogin.Text = "Ocurrio un error con la comunicación con el servidor, contacte con su Administrador"; } }
/// <summary> /// This function gets a new application id /// </summary> /// <returns></returns> private string GetNewApplicationId() { ClsGeneral lgeneral = new ClsGeneral(); string lAppId = lgeneral.GetApplicationId(); lAppId = "I" + lAppId; mApplicationId = lAppId; return(lAppId); }
protected void cboTipoSangre_Init(object sender, EventArgs e) { ASPxComboBox cmbParent = (ASPxComboBox)sender; DataTable dtbCombo = new ClsGeneral().ObtenerTipoSangre(); cmbParent.DataSource = dtbCombo; cmbParent.ValueField = Constantes.ColumnaTipoSangreCodigo; cmbParent.ValueType = typeof(Int32); cmbParent.TextField = Constantes.ColumnaTipoSangreNombre; cmbParent.DataBindItems(); }
protected void cboDocumentoIdentificacion_Init(object sender, EventArgs e) { ASPxComboBox cmbParent = (ASPxComboBox)sender; DataTable dtbCombo = new ClsGeneral().ObtenerDocumentoIdentificacion(); cmbParent.DataSource = dtbCombo; cmbParent.ValueField = Constantes.ColumnaIdentificacionCodigo; cmbParent.ValueType = typeof(Int32); cmbParent.TextField = Constantes.ColumnaIdentificacionNombre; cmbParent.DataBindItems(); }
private void btnUOrgGov_Click(object sender, EventArgs e) { ClsGeneral lgeneral = new ClsGeneral(); ClsUtilities lUtilities = new ClsUtilities(); if (fileDgOrgGovernance.FileName != "") { byte[] lFileContent = lUtilities.ConvertFileToByteArray(fileDgOrgGovernance.FileName); //TODO: Replace these hardcode values lgeneral.InsertFileIntoDB("Behroz", "TestApp", fileDgOrgGovernance.FileName, lFileContent, ClsGeneral.ControlName.UploadOrganizationGovernance); } }
private void Form2_Load(object sender, EventArgs e) { ClsGeneral lgeneral = new ClsGeneral(); DataTable ldt = lgeneral.GetAllApplications(); if (ldt.Rows.Count > 0) { grdApplication.DataSource = ldt; } else { } }
protected void cboTipoSangre_Init(object sender, EventArgs e) { ASPxComboBox cmbParent = (ASPxComboBox)sender; //GridViewDataRowTemplateContainer templateContainer = (GridViewDataRowTemplateContainer)cmbParent.NamingContainer; GridViewEditFormTemplateContainer templateContainer = (GridViewEditFormTemplateContainer)cmbParent.NamingContainer; //cmbParent.ClientSideEvents.SelectedIndexChanged = string.Format("function(s, e) {{ OnSelectedIndexChanged(s, e, {0}); }}", templateContainer.VisibleIndex); DataTable dtbCombo = new ClsGeneral().ObtenerTipoSangre(); cmbParent.DataSource = dtbCombo; cmbParent.ValueField = Constantes.ColumnaTipoSangreCodigo; cmbParent.ValueType = typeof(Int32); cmbParent.TextField = Constantes.ColumnaTipoSangreNombre; cmbParent.DataBindItems(); ObtenerDatosEmpleado(); SelecetedCbo(_strTipoSangre, cmbParent); }
protected void ddlBaseLocation_SelectedIndexChanged(object sender, EventArgs e) { if (ddlBaseLocation == null) { return; } try { switch (ddlBaseLocation.SelectedIndex) { case 0: txtContactNumber.Text = ""; txtLatitude.Text = ""; txtLongitude.Text = ""; break; default: var dsblcn = (DataSet)ViewState["ContactNumber"]; var dv = new DataView(dsblcn.Tables[0], "Location_ID =" + Convert.ToInt32(ddlBaseLocation.SelectedItem.Value), "Contact_Number", DataViewRowState.CurrentRows); txtContactNumber.Text = dv[0]["Contact_Number"].ToString(); txtLatitude.Text = dv[0]["latitude"].ToString(); txtLongitude.Text = dv[0]["longitude"].ToString(); var csg = new ClsGeneral(); var dtVehData = csg.getVehiclesinRadius(txtLatitude.Text, txtLongitude.Text, ConfigurationManager.AppSettings["Locateveh"]); if (dtVehData.Rows.Count > 0) { lblVeh.Text = "Vehicles that are under " + ConfigurationManager.AppSettings["Locateveh"] + "KMs to base location "; grdVehicleData.DataSource = dtVehData; grdVehicleData.DataBind(); } break; } } catch (Exception ex) { _helper.ErrorsEntry(ex); } }
protected void btnSave_Click(object sender, EventArgs e) { if (ddlVehType.SelectedIndex <= 0) { Show("Please Select vehicle type"); return; } //if(us2lat.Text == "" || us2lon.Text == "" ) //{ // Show("Please Select Latitude or Longitude"); // return; //} vehallobj.OffRoadVehcileId = Convert.ToInt32(ddlVehicleNumber.SelectedItem.Value); vehallobj.OffRoadVehicleNo = ddlVehicleNumber.SelectedItem.Text; vehallobj.DistrictId = Convert.ToInt32(ddlDistrict.SelectedItem.Value); vehallobj.District = ddlDistrict.SelectedItem.Text; string manids = ""; //if (ddlSegments.Visible) //{ // vehallobj.SegmentId = Convert.ToInt32(ddlSegments.SelectedItem.Value); // vehallobj.Segment = ddlSegments.SelectedItem.Text; // //vehallobj.NewSegFlag = "Old"; // //vehallobj.NewSegMandalIds = ""; // vehallobj.NewSegFlag = "New"; // for (int i = 1; i < ddlMandal.Items.Count; i++) // manids = manids + ddlMandal.Items[i].Value.ToString() + ","; // vehallobj.NewSegMandalIds = manids; //} //else //{ // //string manids = ""; // vehallobj.SegmentId = 0; // // vehallobj.Segment = txtNewSegment.Text; // vehallobj.NewSegFlag = "New"; // for (int i = 1; i < ddlMandal.Items.Count; i++) // manids = manids + ddlMandal.Items[i].Value.ToString() + ","; // vehallobj.NewSegMandalIds = manids; //} vehallobj.MandalId = Convert.ToInt32(ddlMandal.SelectedItem.Value); vehallobj.Mandal = ddlMandal.SelectedItem.Text; vehallobj.CityId = Convert.ToInt32(ddlCity.SelectedItem.Value); vehallobj.City = ddlCity.SelectedItem.Text; if (ddlBaseLocation.Visible) { vehallobj.BaseLocationId = Convert.ToInt32(ddlBaseLocation.SelectedItem.Value); vehallobj.BaseLocation = ddlBaseLocation.SelectedItem.Text; vehallobj.Flag = "Old"; vehallobj.Latitude = "0.00"; vehallobj.Longitude = "0.00"; // Bind Lat Longs } else { vehallobj.BaseLocationId = 0; vehallobj.BaseLocation = txtBaseLocation.Text; vehallobj.Flag = "New"; vehallobj.Latitude = txtLatitude.Text; vehallobj.Longitude = txtLongitude.Text; } vehallobj.SegmentId = 0; vehallobj.Segment = ""; vehallobj.NewSegFlag = "New"; for (int i = 1; i < ddlMandal.Items.Count; i++) { manids = manids + ddlMandal.Items[i].Value.ToString() + ","; } vehallobj.NewSegMandalIds = manids; vehallobj.SegmentId = 0; // vehallobj.BaseLocationId = 0; // vehallobj.BaseLocation = ""; // vehallobj.Flag = "New"; vehallobj.Latitude = txtLatitude.Text; vehallobj.Longitude = txtLongitude.Text; vehallobj.ContactNumber = txtContactNumber.Text; vehallobj.VehType = ddlVehType.SelectedItem.Value.ToString(); DataTable dtGetVehData = new DataTable(); ClsGeneral clsGen = new ClsGeneral(); dtGetVehData = clsGen.getVehicleData(ddlVehicleNumber.SelectedItem.Text.ToString()); if (dtGetVehData.Rows.Count > 0) { Show("Vehicle Number Already Exists!!"); ClearAll(); return; } int insres = vehallobj.InsNewVehAllocation_new(); if (insres != 0) { if (ddlBaseLocation.Visible) { clsGen.InsertVehicle(ddlVehicleNumber.SelectedItem.Value, ddlVehicleNumber.SelectedItem.Text, "1", txtContactNumber.Text, txtLatitude.Text, txtLongitude.Text, ddlVehType.SelectedItem.Text.ToString(), ddlDistrict.SelectedItem.Value, ddlMandal.SelectedItem.Value, ddlBaseLocation.SelectedItem.Text); } else { clsGen.InsertVehicle(ddlVehicleNumber.SelectedItem.Value, ddlVehicleNumber.SelectedItem.Text, "1", txtContactNumber.Text, txtLatitude.Text, txtLongitude.Text, ddlVehType.SelectedItem.Text.ToString(), ddlDistrict.SelectedItem.Value, ddlMandal.SelectedItem.Value, txtBaseLocation.Text); } Show("Record Inserted Successfully!!"); } else { Show("Error!!"); } ClearAll(); //if (!ddlSegments.Visible) //{ // if (vehallobj.ChkExistingSegment().Tables[0].Rows.Count > 0) // { // Show("Segment Already Exist!!"); // } // else // { // int insres = vehallobj.InsNewVehAllocation(); // if (insres != 0) // Show("Record Inserted Successfully!!"); // else // Show("Error!!"); // ClearAll(); // } //} //else //{ // int insres = vehallobj.InsNewVehAllocation(); // if (insres != 0) // Show("Record Inserted Successfully!!"); // else // Show("Error!!"); // ClearAll(); //} }
protected void btnSave_Click(object sender, EventArgs e) { try { if (ddlVehType.SelectedIndex <= 0) { Show("Please Select vehicle type"); } else { _vehallobj.OffRoadVehcileId = Convert.ToInt32(ddlVehicleNumber.SelectedItem.Value); _vehallobj.OffRoadVehicleNo = ddlVehicleNumber.SelectedItem.Text; _vehallobj.DistrictId = Convert.ToInt32(ddlDistrict.SelectedItem.Value); _vehallobj.District = ddlDistrict.SelectedItem.Text; var manids = ""; _vehallobj.MandalId = Convert.ToInt32(ddlMandal.SelectedItem.Value); _vehallobj.Mandal = ddlMandal.SelectedItem.Text; _vehallobj.CityId = Convert.ToInt32(ddlCity.SelectedItem.Value); _vehallobj.City = ddlCity.SelectedItem.Text; if (ddlBaseLocation.Visible) { _vehallobj.BaseLocationId = Convert.ToInt32(ddlBaseLocation.SelectedItem.Value); _vehallobj.BaseLocation = ddlBaseLocation.SelectedItem.Text; _vehallobj.Flag = "Old"; _vehallobj.Latitude = "0.00"; _vehallobj.Longitude = "0.00"; // Bind Lat Longs } else { _vehallobj.BaseLocationId = 0; _vehallobj.BaseLocation = txtBaseLocation.Text; _vehallobj.Flag = "New"; _vehallobj.Latitude = txtLatitude.Text; _vehallobj.Longitude = txtLongitude.Text; } _vehallobj.SegmentId = 0; _vehallobj.Segment = ""; _vehallobj.NewSegFlag = "New"; for (var i = 1; i < ddlMandal.Items.Count; i++) { manids = manids + ddlMandal.Items[i].Value + ","; } _vehallobj.NewSegMandalIds = manids; _vehallobj.SegmentId = 0; _vehallobj.Latitude = txtLatitude.Text; _vehallobj.Longitude = txtLongitude.Text; _vehallobj.ContactNumber = txtContactNumber.Text; _vehallobj.VehType = ddlVehType.SelectedItem.Value; var clsGen = new ClsGeneral(); var dtGetVehData = clsGen.getVehicleData(ddlVehicleNumber.SelectedItem.Text); var insres = _vehallobj.InsNewVehAllocation_new(); switch (insres) { case 0: Show("Error!!"); break; default: clsGen.InsertVehicle(ddlVehicleNumber.SelectedItem.Value, ddlVehicleNumber.SelectedItem.Text, "1", txtContactNumber.Text, txtLatitude.Text, txtLongitude.Text, ddlVehType.SelectedItem.Text, ddlDistrict.SelectedItem.Value, ddlMandal.SelectedItem.Value, ddlBaseLocation.Visible ? ddlBaseLocation.SelectedItem.Text : txtBaseLocation.Text); if (dtGetVehData.Rows.Count > 0) { UpdateData(ddlVehicleNumber, txtContactNumber.Text, txtLatitude.Text, txtLongitude.Text, ddlDistrict.SelectedItem.Value, ddlMandal.SelectedItem.Value, ddlBaseLocation.SelectedItem.Text); } Show("Record Inserted Successfully!!"); break; } ClearAll(); } } catch (Exception ex) { _helper.ErrorsEntry(ex); } }