protected void btnDelete_Click(object sender, EventArgs e) { clsCompany objCompany = new clsCompany(); objCompany.CreatedBy = Session["uid"].ToString(); StringBuilder strXML = new StringBuilder(); try { strXML.Append("<ENT_COMPANY>"); for (int i = 0; i < gvCompany.Rows.Count; i++) { CheckBox chk = (CheckBox)gvCompany.Rows[i].FindControl("DeleteRows"); if (chk.Checked) { strXML.Append("<Company>"); strXML.Append("<COMPANY_ID>" + gvCompany.Rows[i].Cells[2].Text + "</COMPANY_ID>"); strXML.Append("</Company>"); } } strXML.Append("</ENT_COMPANY>"); clsCompanyHandler.InsertUpdateCompanyDetails(objCompany, "Delete", strXML.ToString(), ref strErrMsg, ref strSuccMsg, clsCommonHandler.PageName()); if (strSuccMsg.Trim().Length >= 1) { lblMessages.Text = strSuccMsg; lblMessages.Visible = true; bindDataGrid(); } } catch (Exception ex) { UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "CompanyMasterView"); } }
private clsCompany DataCompany(SqlDataReader dr) { clsCompany ObjEmpresa = new clsCompany(); ObjEmpresa.ID = Convert.ToInt32(dr["ID_EMPRESA"]); ObjEmpresa.CodigoEstablecimiento = Convert.ToString(dr["COD_ESTABLECIMIENTO"]); ObjEmpresa.NumeroRuc = Convert.ToString(dr["RUC"]); ObjEmpresa.RazonSocial = Convert.ToString(dr["RAZON_SOCIAL"]); ObjEmpresa.NombreComercial = Convert.ToString(dr["NOMBRE_COMERCIAL"]); ObjEmpresa.TipoContribuyente = Convert.ToString(dr["TIPO_CONTRIBUYENTE"]); ObjEmpresa.Direccion = Convert.ToString(dr["DIRECCION"]); ObjEmpresa.Departamento = Convert.ToString(dr["DEPARTAMENTO"]); ObjEmpresa.Provincia = Convert.ToString(dr["PROVINCIA"]); ObjEmpresa.Distrito = Convert.ToString(dr["DISTRITO"]); ObjEmpresa.Telefono = Convert.ToString(dr["E_TELEFONO"]); ObjEmpresa.EstadoEmpresa = Convert.ToString(dr["ESTADO_EMPRESA"]); ObjEmpresa.CorreoElectronico = Convert.ToString(dr["CORREO_ELECTRONICO"]); ObjEmpresa.TipoEmpleadorId = Convert.ToInt32(dr["TIPO_EMPLEADORID"]); ObjEmpresa.ActividadId = Convert.ToInt32(dr["ACTIVIDADID"]); ObjEmpresa.AporteSenati = Convert.ToBoolean(dr["APORTE_SENATI"]); ObjEmpresa.Status = Convert.ToInt32(dr["ESTADO"]); //ObjEmpresa.DireccionesRiesgo = DataAddressesRisk(dr); ObjEmpresa.LaborSocialEmpresa = DataLabourSocialCompany(dr); ObjEmpresa.RepresentateLegal = DataLegalRepresentative(dr); ObjEmpresa.Responsable = DataInCharge(dr); return(ObjEmpresa); }
private void GetAllCompanyIds() { try { clsCompany objCom = new clsCompany(); DataSet dsComData = objCom.GetAllCompanyData(); if (dsComData.Tables[0].Rows.Count != 0) { ddlCompanyId.DataSource = dsComData.Tables[0]; ddlCompanyId.DataTextField = "CompanyName"; ddlCompanyId.DataValueField = "CompanyId"; ddlCompanyId.DataBind(); ddlCompanyId.Items.Insert(0, "--Select One--"); } else { ddlCompanyId.Items.Insert(0, "--Select One--"); ddlCompanyId.Items.Insert(1, "No Products"); } } catch (Exception ex) { lblMsg.Text = ex.Message; } }
public void AddMethodOK() { //create an instance of the class we want to create clsCompanyCollection AllCompanies = new clsCompanyCollection(); //create an item of test data clsCompany TestItem = new clsCompany(); //var to store the primary key Int32 PrimaryKey = 0; //set it's properties TestItem.CompanyID = 1; TestItem.CompanyName = "some company"; TestItem.Address = "some address"; TestItem.PostCode = "le2 7pt"; TestItem.TeleNum = "12345678910"; TestItem.Email = "someEmail@com"; TestItem.Description = "this is an example"; //set ThisCompany to the test data AllCompanies.ThisCompany = TestItem; //add the record PrimaryKey = AllCompanies.Add(); //set the primary key of the test data TestItem.CompanyID = PrimaryKey; //find the record AllCompanies.ThisCompany.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllCompanies.ThisCompany, TestItem); }
protected void btnSave_Click(object sender, EventArgs e) { clsCompany obj = new clsCompany(); obj.Name = txtName.Text; obj.Address = txtAddress.Text; obj.Tin = txtTin.Text; obj.Cst = txtCst.Text; if (Logo.HasFile) { try { string filepath = MapPath(imgLogo.ImageUrl); File.Delete(@filepath); } catch { } } obj.Logo = UploadPhoto(); obj.Op = 2; obj.CompanyMster(obj); obj.Op = 1; obj.CompanyMster(obj); LoadData(); }
protected void btnSubmitAdd_Click(object sender, EventArgs e) { try { clsCompany objCompany = new clsCompany(); objCompany.CreatedBy = Session["uid"].ToString(); objCompany.CompId = txtCompanyIDAdd.Text.Trim().ToUpper(); objCompany.CompName = txtDescriptionAdd.Text.Trim(); objCompany.CompAddress = txtRegisteredAddressAdd.Text.Trim(); objCompany.CompROAddress = txtHOAddressAdd.Text.Trim(); objCompany.CompCity = txtRegisteredCityAdd.Text.Trim(); objCompany.CompROCity = txtHOCityAdd.Text.Trim(); objCompany.CompPin = txtRegisteredPinAdd.Text.Trim(); objCompany.CompROPin = txtHOPinAdd.Text.Trim(); objCompany.CompPhone1 = txtRegisteredPhone1Add.Text.Trim(); objCompany.CompPhone2 = txtRegisteredPhone2Add.Text.Trim(); objCompany.CompROPhone1 = txtHOPhone1Add.Text.Trim(); objCompany.CompROPhone2 = txtHOPhone2Add.Text.Trim(); objCompany.CompState = ((ddlRegisteredStateAdd.SelectedIndex == 0) ? "" : ddlRegisteredStateAdd.SelectedValue); objCompany.CompROState = ((ddlHOStateAdd.SelectedIndex == 0) ? "" : ddlHOStateAdd.SelectedValue); clsCompanyHandler.InsertUpdateCompanyDetails(objCompany, "Insert", "", ref strErrMsg, ref strSuccMsg, clsCommonHandler.PageName()); if (strErrMsg.Trim().Length >= 1) { lblError.Text = strErrMsg; lblError.Visible = true; mpeAddCompany.Show(); ScriptManager.RegisterClientScriptBlock(UpdatePanel1, UpdatePanel1.GetType(), "Script", "validateChosen();", true); return; } else { txtCompanyIDAdd.Text = ""; txtDescriptionAdd.Text = ""; txtRegisteredAddressAdd.Text = ""; txtRegisteredCityAdd.Text = ""; txtRegisteredPinAdd.Text = ""; ddlRegisteredStateAdd.SelectedIndex = 0; txtRegisteredPhone1Add.Text = ""; txtRegisteredPhone2Add.Text = ""; ChkAddressAdd.Checked = false; txtHOAddressAdd.Text = ""; txtHOCityAdd.Text = ""; txtHOPinAdd.Text = ""; ddlHOStateAdd.SelectedIndex = 0; txtHOPhone1Add.Text = ""; txtHOPhone2Add.Text = ""; lblError.Text = strSuccMsg; lblError.Visible = true; bindDataGrid(); mpeAddCompany.Show(); ScriptManager.RegisterClientScriptBlock(UpdatePanel1, UpdatePanel1.GetType(), "Script", "validateChosen();", true); } } catch (Exception ex) { UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName()); } }
public ActionResult AddUpdateCompany(int id) { clsCompany city = new clsCompany(); if (id > 0) { city = (from c in db.tblCompanies where c.CompanyId == id select new clsCompany { CompanyId = c.CompanyId, CompanyName = c.CompanyName, CityId = c.CityId, CityName = db.tblCities.Where(x => x.CityId == c.CountryId).Select(x => x.CityName).FirstOrDefault(), CountryId = c.CountryId, CountryName = db.tblCountries.Where(x => x.CountryId == c.CountryId).Select(x => x.CountryName).FirstOrDefault() }).FirstOrDefault(); } else { city = new clsCompany { CompanyId = 0, CompanyName = "", CityId = 0, CityName = "", CountryId = 0, CountryName = "" }; } return(PartialView(city)); }
public void ListAndCountOK() { //create an instance of the class we want to create clsCompanyCollection AllCompanies = new clsCompanyCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsCompany> TestList = new List <clsCompany>(); //add an item to the list //create the item of test data clsCompany TestItem = new clsCompany(); //set it's properties TestItem.CompanyID = 1; TestItem.CompanyName = "Some Company"; TestItem.Address = "Some Address"; TestItem.PostCode = "LE2 7PT"; TestItem.TeleNum = "1234567890"; TestItem.Email = "*****@*****.**"; TestItem.Description = "This is an example"; //add the item to the list TestList.Add(TestItem); //assign the data to the property AllCompanies.CompanyList = TestList; //test to see that it exists Assert.AreEqual(AllCompanies.Count, TestList.Count); }
public clsCompany CompanyAll(ref BaseEntity Base, Int16 EmpresaId) { clsCompany ObjEmpresa = null; SqlDataReader dr = null; SqlCommand cmd = null; try { cmd = new SqlCommand("sp_xP_Datos_Empresa", clsConnection.GetConnection()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SetCompanyID", EmpresaId); dr = cmd.ExecuteReader(); //if (dr.Read()) //User = GetEntity_v3(dr); if (dr.Read()) { ObjEmpresa = DataCompany(dr); } } catch (Exception ex) { ObjEmpresa = null; Base.Errors.Add(new BaseEntity.ListError(ex, "Recursos No Encontrados")); } finally { if (dr != null) { dr.Close(); } clsConnection.DisposeCommand(cmd); } return(ObjEmpresa); }
protected void btnShowAll_Click(object sender, EventArgs e) { try { if (btnShowAll.Text == "Show All") { objCompany = new clsCompany(); DataSet ds = objCompany.GetAllCompanyData(); if (ds.Tables[0].Rows.Count != 0) { grdCompany.DataSource = ds.Tables[0]; grdCompany.DataBind(); } else { grdCompany.EmptyDataText = "No Records Found to display."; grdCompany.DataBind(); } divCompany.Visible = true; btnShowAll.Text = "Close"; } else if (btnShowAll.Text == "Close") { divCompany.Visible = false; btnShowAll.Text = "Show All"; } } catch (Exception ex) { lblMsg.Text = ex.Message; } }
public ActionResult DeleteCompany(int id) { string message = ""; bool status = false; clsCompany st = new clsCompany(); st.CompanyId = id; string returnId = InsertUpdateCompanyDb(st, "Delete"); if (returnId == "Success") { ModelState.Clear(); status = true; message = "User Type Successfully Deleted"; } else { ModelState.Clear(); status = false; message = returnId; } return(new JsonResult { Data = new { status = status, message = message } }); }
private string InsertUpdateCompanyDb(clsCompany st, string insertUpdateStatus) { string returnId = "0"; string connection = System.Configuration.ConfigurationManager.ConnectionStrings["ADO"].ConnectionString; using (SqlConnection con = new SqlConnection(connection)) { try { con.Open(); using (SqlCommand cmd = new SqlCommand("spInsertUpdateCompany", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.Add("@CompanyId", SqlDbType.Int).Value = st.CompanyId; cmd.Parameters.Add("@CompanyName", SqlDbType.NVarChar).Value = st.CityName; cmd.Parameters.Add("@CityId", SqlDbType.Int).Value = st.CityId; cmd.Parameters.Add("@CountryId", SqlDbType.Int).Value = st.CountryId; cmd.Parameters.Add("@InsertUpdateStatus", SqlDbType.NVarChar).Value = insertUpdateStatus; cmd.Parameters.Add("@CheckReturn", SqlDbType.NVarChar, 300).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); returnId = cmd.Parameters["@CheckReturn"].Value.ToString(); cmd.Dispose(); } con.Close(); con.Dispose(); } catch (Exception ex) { returnId = ex.Message.ToString(); } } return(returnId); }
public void InstanceOK() { //create an instance of the clsCompany class clsCompany ACompany = new clsCompany(); //check to see that the class is not null Assert.IsNotNull(ACompany); }
public void InstanceOK() { //create an instance of the class we want to create clsCompany AnCompany = new clsCompany(); //test to see that it exists Assert.IsNotNull(AnCompany); }
public void Company_WebsiteOK() { //create an instance of the class we want to create clsCompany AnCompany = new clsCompany(); //create some test data to assign to the property string TestData = "Google.Com"; //assign the data to the property AnCompany.Company_Website = TestData; //test to see that the two values are the same Assert.AreEqual(AnCompany.Company_Website, TestData); }
public void Company_DescriptionOK() { //create an instance of the class we want to create clsCompany AnCompany = new clsCompany(); //create some test data to assign to the property string TestData = "Google is a great company to work for"; //assign the data to the property AnCompany.Company_Description = TestData; //test to see that the two values are the same Assert.AreEqual(AnCompany.Company_Description, TestData); }
public void ThisCompanyPropertyOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); clsCompany TestCompany = new clsCompany(); TestCompany.Active = true; TestCompany.CompanyName = "DMU"; TestCompany.CompanyAddress = "85 street"; TestCompany.Email = "*****@*****.**"; TestCompany.ContactNo = "33"; AllCompanies.ThisCompany = TestCompany; Assert.AreEqual(AllCompanies.ThisCompany, TestCompany); }
public void FindMethodOK() { //create an instance of the class we want to create clsCompany AnCompany = new clsCompany(); //boolean variable to store the reslt of the validation Boolean Found = false; //create some test data to use with the method int CompanyId = 1; //invoke the method Found = AnCompany.Find(CompanyId); //test to see that the result is correct Assert.IsTrue(Found); }
void LoadData() { clsCompany obj = new clsCompany(); obj.Op = 3; System.Data.DataTable dt = obj.CompanyMster(obj).Tables[0]; if (dt.Rows.Count > 0) { txtName.Text = dt.Rows[0]["Name"].ToString(); txtAddress.Text = dt.Rows[0]["Address"].ToString(); txtTin.Text = dt.Rows[0]["Tin"].ToString(); txtCst.Text = dt.Rows[0]["Cst"].ToString(); imgLogo.ImageUrl = "~/" + dt.Rows[0]["Logo"].ToString(); } }
public void ListAndCountOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); List <clsCompany> TestList = new List <clsCompany>(); clsCompany TestItem = new clsCompany(); TestItem.Active = true; TestItem.CompanyName = "DMU"; TestItem.CompanyAddress = "85 street"; TestItem.Email = "*****@*****.**"; TestItem.ContactNo = "33"; TestList.Add(TestItem); AllCompanies.CompanyList = TestList; Assert.AreEqual(AllCompanies.Count, TestList.Count); }
public clsCompany CompanyAll(ref BaseEntity Base, Int16 EmpresaId) { Base = new BaseEntity(); clsCompany objEmpresa = null; try { objEmpresa = clsCompanyDAO.Instance.CompanyAll(ref Base, EmpresaId); } catch (Exception ex) { Base.Errors.Add(new BaseEntity.ListError(ex, "An error ocurred on application level 2")); } return(objEmpresa); }
public void AddMethodOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); clsCompany TestItem = new clsCompany(); string PrimaryKey = "0744121212"; TestItem.Active = true; TestItem.CompanyName = "DMU"; TestItem.CompanyAddress = "85 street"; TestItem.Email = "*****@*****.**"; TestItem.ContactNo = "33"; AllCompanies.ThisCompany = TestItem; PrimaryKey = AllCompanies.Add(); TestItem.ContactNo = PrimaryKey; //AllCompanies.ThisCompany.//Find(PrimaryKey); //Assert.AreEqual(AllCompanies.ThisCompany, TestItem); }
public void ValidMethodOK() { //create an instance of the class we want to create clsCompany AnCompany = new clsCompany(); //string variable to store any error message Boolean OK = false; //create some test data to pass to the method string Company_Name = "Google"; string Company_Email = "*****@*****.**"; string Company_Description = "Google is a great company to work for"; string Company_Website = "Google.Com"; //invoke the method OK = AnCompany.Valid(Company_Name, Company_Email, Company_Description, Company_Website); //test to see that the result is correct Assert.IsTrue(OK); }
public void Company_NameMinLessOne() { //create an instance of the class we want to create clsCompany AnCompany = new clsCompany(); //Boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string Company_Name = "";// This should trigger an error string Company_Email = "*****@*****.**"; string Company_Description = "Google is a great company to work for"; string Company_Website = "Google.Com"; //invoke the method OK = AnCompany.Valid(Company_Name, Company_Email, Company_Description, Company_Website); //test to see that the result is correct Assert.IsFalse(OK); }
protected void Page_Load(object sender, EventArgs e) { if (Request["__EVENTTARGET"] == "ctl00$btnBack_Classic") { Response.Redirect("https://" + Request.ServerVariables["HTTP_HOST"] + Session["SourcePage"]); } if (!Page.IsPostBack) { gvList.DataSource = clsCompany.getCompanyInsurance(); gvList.DataBind(); } else { if (Request["cbox"] == null || Request["status"] == null) { Response.End(); } bool isChecked = Request["status"] == "checked" ? true : false; int CompanyID = int.Parse(Request["cbox"]); clsCompany comp = new clsCompany(CompanyID); comp.setConfirmationStatus = isChecked; } }
public bool CompanySaveData(ref BaseEntity Entity, clsCompany Empresa) { Entity = new BaseEntity(); bool bolSuccess = false; try { if (Entity != null) { bolSuccess = clsCompanyDAO.Instance.CompanySaveData(ref Entity, Empresa); } } catch (Exception ex) { Entity.Errors.Add(new BaseEntity.ListError(ex, "An error occured sending data.")); } return(bolSuccess); }
private void DataGridRecord_PreviewMouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { try { if (DataGridRecord.SelectedItems.Count > 0) { if (!DataGridRecord.SelectedItems[0].ToString().Equals("{NewItemPlaceholder}")) { clsCompany _decide = (clsCompany)DataGridRecord.SelectedItems[0]; AddOrUpdate("update", _decide); } } } catch (Exception ex) { MessageBox.Show("异常:\n" + ex.Message); } }
public void Company_DescriptionMax() { //create an instance of the class we want to create clsCompany AnCompany = new clsCompany(); //Boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string Company_Name = "Runner"; string Company_Email = "*****@*****.**"; string Company_Description = "";// This should trigger an Pass Company_Description = Company_Description.PadRight(100, 'a'); string Company_Website = "Google.Com"; //invoke the method OK = AnCompany.Valid(Company_Name, Company_Email, Company_Description, Company_Website); //test to see that the result is correct Assert.IsTrue(OK); }
public void DeleteMethodOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); clsCompany TestItem = new clsCompany(); string PrimaryKey = "0744121212"; TestItem.Active = true; TestItem.CompanyName = "DMU"; TestItem.CompanyAddress = "85 street"; TestItem.Email = "*****@*****.**"; TestItem.ContactNo = "33"; AllCompanies.ThisCompany = TestItem; PrimaryKey = AllCompanies.Add(); TestItem.ContactNo = PrimaryKey; //AllCompanies.ThisCompany.Find(PrimaryKey); AllCompanies.Delete(); //Boolean Found = AllCompanies.ThisCompany.Find(PrimaryKey); //Assert.IsFalse(Found); }
private void BindCompayId() { try { clsCompany objCom = new clsCompany(); DataSet ds = objCom.GetAllCompanyData(); if (ds.Tables[0].Rows.Count != 0) { ddlCompanyBrandId.DataSource = ds.Tables[0]; ddlCompanyBrandId.DataTextField = "CompanyName"; ddlCompanyBrandId.DataValueField = "CompanyId"; ddlCompanyBrandId.DataBind(); } ddlCompanyBrandId.Items.Insert(0, "--Select One--"); } catch (Exception ex) { lblMsg.Text = ex.Message; } }
public void ThisCompanyPropertyOK() { //create an instance of the class we want to create clsCompanyCollection AllCompanies = new clsCompanyCollection(); //create some test data to assign to the property clsCompany TestCompany = new clsCompany(); //set it's properties of the test object TestCompany.CompanyID = 1; TestCompany.CompanyName = "Some Company"; TestCompany.Address = "Some Address"; TestCompany.PostCode = "LE2 7PT"; TestCompany.TeleNum = "1234567890"; TestCompany.Email = "*****@*****.**"; TestCompany.Description = "This is an example"; //assign the data to the property AllCompanies.ThisCompany = TestCompany; //test to see that it exists Assert.AreEqual(AllCompanies.ThisCompany, TestCompany); }