public List<FirmOperationsExt> GetFirmOperations() { string CultureValue = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; List<FirmOperationsExt> list = new List<FirmOperationsExt>(); DataTable dt = new DataTable(); SQLCon.Open(); SqlCommand cmd = new SqlCommand("B_GetFirm_TB_Firm_SP", SQLCon); cmd.Parameters.AddWithValue("@CultureCode", CultureValue); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(dt); SQLCon.Close(); // return dt; if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { FirmOperationsExt FirmObj = new FirmOperationsExt(); FirmObj.ID = Convert.ToInt32(dr["ID"]); FirmObj.Firm = dr["Name"].ToString(); FirmObj.CountryID = dr["CountryID"].ToString(); FirmObj.Country = dr["Country"].ToString(); FirmObj.RegionID = dr["RegionID"].ToString(); FirmObj.Region = dr["Region"].ToString(); FirmObj.City = dr["City"].ToString(); FirmObj.Address = dr["Address"].ToString(); FirmObj.Postal_code = dr["PostCode"].ToString(); FirmObj.Phone = dr["Phone"].ToString(); FirmObj.Fax = dr["Fax"].ToString(); FirmObj.Email = dr["Email"].ToString(); FirmObj.Tax_Office = dr["TaxOffice"].ToString(); FirmObj.Tax_ID = dr["TaxID"].ToString(); FirmObj.Executive_TitleID = dr["ExecutiveTitleID"].ToString(); FirmObj.Executive_Title = dr["ExecutiveTitle"].ToString(); FirmObj.Executive_Name = dr["ExecutiveName"].ToString(); FirmObj.Executive_Surname = dr["ExecutiveSurname"].ToString(); FirmObj.Executive_Position = dr["ExecutivePosition"].ToString(); FirmObj.Executive_Phone = dr["ExecutivePhone"].ToString(); FirmObj.Executive_Email = dr["ExecutiveMail"].ToString(); FirmObj.StatusID = dr["StatusID"].ToString(); FirmObj.Status = dr["Status"].ToString(); FirmObj.Active = Convert.ToBoolean(dr["Active"]); FirmObj.IPaddress = dr["IPAddress"].ToString(); FirmObj.Created_Date = dr["CreatedDate"].ToString(); FirmObj.Updated_Date = dr["UpdatedDate"].ToString(); list.Add(FirmObj); } } return list; }
public bool Create(FirmOperationsExt model, ModelStateDictionary modelState, Controller ctrl) { bool status = true; //Wrap it all in a transaction TransactionOptions transOptions = SetTransactionTimeoutForDebugging(HttpContext.Current); using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, transOptions)) { } return status; }