Beispiel #1
0
        public void AddCustomer(CustomerDM customer)
        {
            DBUtilities utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_InsertCustomer";

            utility.cmd.Parameters.Add("Name", customer.Name);
            utility.cmd.Parameters.Add("Surname", customer.Surname);
            utility.cmd.Parameters.Add("Title", customer.Title);
            utility.cmd.Parameters.Add("Gender", customer.Gender);
            utility.cmd.Parameters.Add("DateOfBirth", customer.DateOfBirth);
            utility.cmd.Parameters.Add("TCNo", customer.TCNo);
            utility.cmd.Parameters.Add("TaxNo", customer.TaxNo);
            utility.cmd.Parameters.Add("TaxAdministration", customer.TaxAdministration);
            utility.cmd.Parameters.Add("City", customer.City);
            utility.cmd.Parameters.Add("Town", customer.Town);
            utility.cmd.Parameters.Add("Address", customer.Address);
            utility.cmd.Parameters.Add("HomePhone", customer.HomePhone);
            utility.cmd.Parameters.Add("BusinessPhone", customer.BusinessPhone);
            utility.cmd.Parameters.Add("CepPhone", customer.CepPhone);
            utility.cmd.ExecuteScalar();

            utility.endC();
        }
Beispiel #2
0
        private void GetPayrollsFromDB()
        {
            dBUtilitiesCon = new DBUtilities();
            DataTable dt = dBUtilitiesCon.GetData("select dbo.Payrolls.ID, concat(e.FirstName, ' ', e.LastName) as FullName, RateHour, HourDay, DaysWorked, DatePay, Month, Description from dbo.Payrolls inner join dbo.Employees e on EmployeeId = e.ID order by dbo.Payrolls.ID; ");

            if (dt?.Rows?.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    sqlPay.Add(new PayrollViewModel()
                    {
                        Id          = Convert.ToInt32(row["ID"]),
                        FullName    = row["FullName"].ToString(),
                        RateHour    = row["RateHour"].ToString(),
                        HourDay     = row["HourDay"].ToString(),
                        DaysWorked  = row["DaysWorked"].ToString(),
                        DatePay     = row["DatePay"].ToString(),
                        Month       = row["Month"].ToString(),
                        Description = row["Description"].ToString(),
                    });

                    var source = new BindingSource(sqlPay, null);
                    dgvPayrolls.DataSource = source;
                }
            }
        }
Beispiel #3
0
        public List <CarDM> popCar()
        {
            List <CarDM> carList = new List <CarDM>();
            DBUtilities  utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_popCar";
            utility.cmd.ExecuteScalar();
            SqlDataReader dr = utility.cmd.ExecuteReader();

            while (dr.Read())
            {
                CarDM cdm = new CarDM();
                cdm.ID            = Convert.ToInt32(dr["ID"]);
                cdm.licensePlate  = dr["LicensePlate"].ToString();
                cdm.chassisNumber = dr["ChassisNumber"].ToString();
                cdm.color         = dr["Color"].ToString();
                cdm.amount        = dr["Amount"].ToString();
                cdm.brand         = dr["BrandName"].ToString();
                cdm.model         = dr["ModelName"].ToString();
                cdm.status        = dr["Status"].ToString();
                cdm.model_year    = dr["ModelYear"].ToString();
                carList.Add(cdm);
            }

            dr.Close();
            utility.endC();
            return(carList);
        }
Beispiel #4
0
 public EmployeeAddForm()
 {
     InitializeComponent();
     dbUtilitiesCon = new DBUtilities();
     LoadGender();
     ValidateControls();
 }
Beispiel #5
0
        private void GetContractsFromDB()
        {
            dbUtilConn = new DBUtilities();
            DataTable dt = dbUtilConn.GetData("select dbo.Contracts.ID, e.FirstName, e.LastName, e.Code, t.Value, DateFrom, DateTo, ConclusionDate from dbo.Contracts " +
                                              "inner join dbo.Employees e on EmployeeId = e.ID " +
                                              "inner join dbo.TypeContracts t on TypeContractId = t.ID order by dbo.Contracts.ID;");

            if (dt?.Rows?.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    sqlCtr.Add(new ContractViewModel()
                    {
                        Id             = Convert.ToInt32(row["ID"]),
                        LastName       = row["FirstName"].ToString(),
                        FirstName      = row["LastName"].ToString(),
                        Code           = row["Code"].ToString(),
                        TypeContract   = row["Value"].ToString(),
                        DateFrom       = row["DateFrom"].ToString(),
                        DateTo         = row["DateTo"].ToString(),
                        ConclusionDate = row["ConclusionDate"].ToString(),
                        TerminationWay = string.Empty,
                    });

                    var source = new BindingSource(sqlCtr, null);
                    dgvContracts.DataSource = source;
                }
            }
        }
Beispiel #6
0
 public AddDepartamentForm()
 {
     InitializeComponent();
     dbUtilitiesCon = new DBUtilities();
     LoadEmployee();
     LoadParentDepartament();
 }
Beispiel #7
0
        private void GetSalaryFromDB()
        {
            dbUtilConn = new DBUtilities();

            DataTable salaryData = dbUtilConn.GetData("select dbo.Contracts.ID, Salary, c.Value, t.Value, DateFrom, DateTo from dbo.Contracts " +
                                                      "inner join dbo.Currencies c on dbo.Contracts.CurrencyId = c.ID " +
                                                      "inner join dbo.TypeRates t on dbo.Contracts.TypeRateId = t.ID order by dbo.Contracts.ID;");

            if (salaryData?.Rows?.Count > 0)
            {
                foreach (DataRow row in salaryData.Rows)
                {
                    sqlSal.Add(new SalaryViewModel()
                    {
                        Id       = Convert.ToInt32(row["ID"]),
                        Salary   = row["Salary"].ToString(),
                        Currency = row["Value"].ToString(),
                        TypeRate = row["Value"].ToString(),
                        DateFrom = row["DateFrom"].ToString(),
                        DateTo   = row["DateTo"].ToString()
                    });

                    var source = new BindingSource(sqlSal, null);
                    dgvSalaries.DataSource = source;
                }
            }
        }
Beispiel #8
0
        public UserDM LoginControl(string Username, string Password)
        {
            UserDM udt = new UserDM();

            DBUtilities utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_Login";
            utility.cmd.Parameters.Add("Username", Username);
            utility.cmd.Parameters.Add("Password", Password);
            SqlDataReader dr = utility.cmd.ExecuteReader();

            while (dr.Read())
            {
                if (dr["Username"].ToString().Trim() == Username && dr["Password"].ToString().Trim() == Password)
                {
                    udt.Username = dr["Username"].ToString().Trim();
                    udt.Password = dr["Password"].ToString().Trim();
                }
            }



            dr.Close();
            utility.endC();
            return(udt);
        }
Beispiel #9
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            if (ShowAllStations)
            {
                PushpinLayer.Children.Clear();

                string    query = "select StartLocation, EndLocation from Route";
                DataTable data  = DBUtilities.ExecuteQuery(query, ConnectionString);

                foreach (DataRow row in data.Rows)
                {
                    Pushpin startpin = new Pushpin();
                    double  lat      = double.Parse(row[0].ToString().Split(',')[0]);
                    double  lon      = double.Parse(row[0].ToString().Split(',')[1]);
                    startpin.Location    = new Location(lat, lon);
                    startpin.MouseEnter += ReverseGeocode;

                    Pushpin endpin = new Pushpin();
                    lat                = double.Parse(row[1].ToString().Split(',')[0]);
                    lon                = double.Parse(row[1].ToString().Split(',')[1]);
                    endpin.Location    = new Location(lat, lon);
                    endpin.MouseEnter += ReverseGeocode;

                    PushpinLayer.Children.Add(startpin);
                    PushpinLayer.Children.Add(endpin);
                }

                ShowAllStations = false;
            }
            else
            {
                PushpinLayer.Children.Clear();
                ShowAllStations = true;
            }
        }
        public ActionResult ShiftManagmentSubmit(ShiftModel objPOTypeDataModel)
        {
            string          UserId;
            eTracLoginModel ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                UserId        = Convert.ToString(ObjLoginModel.UserId);
            }
            try
            {
                if (objPOTypeDataModel.Id == 0)
                {
                    string    SQRY = "EXEC INSERT_Shift_Details '" + objPOTypeDataModel.ShiftCode + "','" + objPOTypeDataModel.ShiftName + "','" + objPOTypeDataModel.Description + "','" + objPOTypeDataModel.IsActive + "','" + Convert.ToString(ObjLoginModel.UserId) + "','" + objPOTypeDataModel.StartTime + "','" + objPOTypeDataModel.EndTime + "'  ";
                    DataTable DT   = DBUtilities.GetDTResponse(SQRY);
                }
                else
                {
                    string    SQRY1 = "Update Tbl_HRMS_Shift SET ShiftCode='" + objPOTypeDataModel.ShiftCode + "',ShiftName='" + objPOTypeDataModel.ShiftName + "',Description='" + objPOTypeDataModel.Description + "',IsActive='" + objPOTypeDataModel.IsActive + "',UpdatedBy='" + Convert.ToString(ObjLoginModel.UserId) + "',StartTime='" + objPOTypeDataModel.StartTime + "',EndTime='" + objPOTypeDataModel.EndTime + "' where Id='" + objPOTypeDataModel.Id + "' ";
                    DataTable DT    = DBUtilities.GetDTResponse(SQRY1);
                }
            }
            catch (Exception ex)
            {
                ViewBag.StrError = ex;
            }
            return(RedirectToAction("ShiftMaster"));
        }
Beispiel #11
0
        private void PopulateRouteView()
        {
            RouteView.Nodes.Clear();

            string    query = "select * from Route";
            DataTable data  = DBUtilities.ExecuteQuery(query, ConnectionString);

            foreach (DataRow row in data.Rows)
            {
                Route route = new Route
                {
                    Id            = int.Parse(row["Id"].ToString()),
                    StartLocation = row["StartLocation"].ToString(),
                    EndLocation   = row["EndLocation"].ToString(),
                    Description   = row["Description"].ToString(),
                    Price         = float.Parse(row["Price"].ToString())
                };

                RouteView.Nodes.Add(route.Description);
                RouteView.Nodes[RouteView.Nodes.Count - 1].Nodes.Add("Id: " + route.Id);
                RouteView.Nodes[RouteView.Nodes.Count - 1].Nodes.Add("StartLocation: " + route.StartLocation);
                RouteView.Nodes[RouteView.Nodes.Count - 1].Nodes.Add("EndLocation: " + route.EndLocation);
                RouteView.Nodes[RouteView.Nodes.Count - 1].Nodes.Add("Price: " + route.Price);
            }
        }
Beispiel #12
0
        private void PopulateBusView()
        {
            BusView.Nodes.Clear();

            string    query = "select * from Bus";
            DataTable data  = DBUtilities.ExecuteQuery(query, ConnectionString);

            foreach (DataRow row in data.Rows)
            {
                Bus bus = new Bus
                {
                    Id         = int.Parse(row["Id"].ToString()),
                    SN         = int.Parse(row["SN"].ToString()),
                    Model      = row["Model"].ToString(),
                    Class      = row["Class"].ToString()[0],
                    NumOfSeats = int.Parse(row["NumOfSeats"].ToString()),
                    DriverId   = int.Parse(row["DriverId"].ToString()),
                    RouteId    = int.Parse(row["RouteId"].ToString())
                };

                BusView.Nodes.Add("Bus: " + bus.SN);
                BusView.Nodes[BusView.Nodes.Count - 1].Nodes.Add("Id: " + bus.Id);
                BusView.Nodes[BusView.Nodes.Count - 1].Nodes.Add("Model: " + bus.Model);
                BusView.Nodes[BusView.Nodes.Count - 1].Nodes.Add("Class: " + bus.Class);
                BusView.Nodes[BusView.Nodes.Count - 1].Nodes.Add("NumOfSeats: " + bus.NumOfSeats);
                BusView.Nodes[BusView.Nodes.Count - 1].Nodes.Add("DriverId: " + bus.DriverId);
                BusView.Nodes[BusView.Nodes.Count - 1].Nodes.Add("RouteId: " + bus.RouteId);
            }
        }
Beispiel #13
0
        private void PopulateDriverView()
        {
            DriverView.Nodes.Clear();

            string    query = "select * from Driver";
            DataTable data  = DBUtilities.ExecuteQuery(query, ConnectionString);

            foreach (DataRow row in data.Rows)
            {
                Driver driver = new Driver
                {
                    Id     = int.Parse(row["Id"].ToString()),
                    Name   = row["Name"].ToString(),
                    EMail  = row["EMail"].ToString(),
                    Phone  = row["Phone"].ToString(),
                    Age    = int.Parse(row["Age"].ToString()),
                    Salary = float.Parse(row["Salary"].ToString())
                };

                DriverView.Nodes.Add("Driver: " + driver.Name);
                DriverView.Nodes[DriverView.Nodes.Count - 1].Nodes.Add("Id: " + driver.Id);
                DriverView.Nodes[DriverView.Nodes.Count - 1].Nodes.Add("EMail: " + driver.EMail);
                DriverView.Nodes[DriverView.Nodes.Count - 1].Nodes.Add("Phone: " + driver.Phone);
                DriverView.Nodes[DriverView.Nodes.Count - 1].Nodes.Add("Age: " + driver.Age);
                DriverView.Nodes[DriverView.Nodes.Count - 1].Nodes.Add("Salary: " + driver.Salary);
            }
        }
Beispiel #14
0
        public List <CarDM> getByDateCarList(DateTime StartDate, DateTime EndDate)
        {
            List <CarDM> carList = new List <CarDM>();
            DBUtilities  utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_getByDateCar";
            utility.cmd.Parameters.Add("StartDate", StartDate);
            utility.cmd.Parameters.Add("EndDate", EndDate);
            utility.cmd.ExecuteScalar();
            SqlDataReader dr = utility.cmd.ExecuteReader();

            while (dr.Read())
            {
                CarDM cdm = new CarDM();
                cdm.ID            = Convert.ToInt32(dr["ID"]);
                cdm.licensePlate  = dr["LicensePlate"].ToString();
                cdm.chassisNumber = dr["ChassisNumber"].ToString();
                cdm.amount        = dr["ToplamTutar"].ToString();
                cdm.color         = dr["Color"].ToString();
                carList.Add(cdm);
            }

            dr.Close();
            utility.endC();
            return(carList);
        }
Beispiel #15
0
        public UserModel LoginControl(string Username, string Password)
        {
            UserModel udt = new UserModel();

            DBUtilities utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "select * from Users WHERE Username='******' and Password='******'";
            SqliteDataReader dr = utility.cmd.ExecuteReader();

            udt.Statu = -1;
            while (dr.Read())
            {
                if (dr["Username"].ToString().Trim() == Username && dr["Password"].ToString().Trim() == Password)
                {
                    udt.Username = dr["Username"].ToString().Trim();
                    udt.Password = dr["Password"].ToString().Trim();
                    udt.Statu    = Convert.ToInt32(dr["Statu"]);
                    udt.ID       = Convert.ToInt32(dr["ID"]);
                }
            }

            if (dr.HasRows == false)
            {
                udt.Username = "******";
                udt.Password = "******";
                udt.Statu    = 1;
            }


            dr.Close();
            utility.endC();
            return(udt);
        }
Beispiel #16
0
 public EditPayrollForm(int payrollId)
 {
     InitializeComponent();
     dbUtilitiesCon = new DBUtilities();
     LoadEmployee();
     GetPayrollFromDB(payrollId);
 }
Beispiel #17
0
        public async Task PatientSearchTestsAsync(String Search, int Count)
        {
            var scopeFactory = _factory.Services;

            using (var scope = scopeFactory.CreateScope())
            {
                var context = scope.ServiceProvider.GetService <DataContext>();
                // Initialize the database, so that changes made by other tests are reset.
                await DBUtilities.InitializeDbForTestsAsync(context);

                // Arrange
                var Request1 = new HttpRequestMessage(HttpMethod.Get, $"api/patient?Search={Search}");

                // Act
                var Response1 = await httpClient.SendAsync(Request1);

                Response1.EnsureSuccessStatusCode();

                var ResponseString = await Response1.Content.ReadAsStringAsync();

                var Patients = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Patient> >(ResponseString);

                // Assert
                Assert.Equal(Count, Patients.Count);
                if (Count > 0)
                {
                    Assert.Equal("Test Patient", Patients[0].Name);
                    Assert.Equal("1234567890", Patients[0].PhoneNumber);
                }
            }
        }
Beispiel #18
0
        public List <Category> ReturnCatogories()
        {
            List <Category> cp = new List <Category>();
            //cp.Add(new Category { Id = 1, Code = "c001", Name = "Category 1" });
            //cp.Add(new Category { Id = 2, Code = "c002", Name = "Category 2" });
            //cp.Add(new Category { Id = 3, Code = "c003", Name = "Category 3" });

            DBUtilities db = new DBUtilities();
            DataTable   dt = db.Select("SelectAllCategories");

            foreach (DataRow r in dt.Rows)
            {
                Category c = new Category();
                c.Code        = r["Code"].ToString();
                c.Description = r["Description"].ToString();
                c.Id          = Convert.ToInt32(r["Id"].ToString());
                c.ImageURL    = r["ImageURL"].ToString();
                c.IsActive    = Convert.ToBoolean(r["IsActive"].ToString());
                c.Name        = r["Name"].ToString();
                c.OrderId     = Convert.ToInt32(r["OrderId"].ToString());

                cp.Add(c);
            }
            return(cp);
        }
Beispiel #19
0
        public async Task PatientTestsAsync(String Name, String PhoneNumber, int Age, String Gender, HttpStatusCode ResponseCode)
        {
            var scopeFactory = _factory.Services;

            using (var scope = scopeFactory.CreateScope())
            {
                var context = scope.ServiceProvider.GetService <DataContext>();
                await DBUtilities.InitializeDbForTestsAsync(context);

                // Arrange
                var request = new HttpRequestMessage(HttpMethod.Post, "api/patient");

                request.Content = new StringContent(JsonSerializer.Serialize(new Patient
                {
                    Name        = Name,
                    PhoneNumber = PhoneNumber,
                    Age         = Age,
                    Gender      = Gender
                }), Encoding.UTF8, "application/json");

                // Act
                var response = await httpClient.SendAsync(request);

                // Assert
                var StatusCode = response.StatusCode;
                Assert.Equal(ResponseCode, StatusCode);
            }
        }
Beispiel #20
0
        public List <ReservationDM> ReservationDetail(int ID)
        {
            List <ReservationDM> carList = new List <ReservationDM>();
            DBUtilities          utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_ReservationDetail";
            utility.cmd.Parameters.Add("ID", ID);
            utility.cmd.ExecuteScalar();
            SqlDataReader dr = utility.cmd.ExecuteReader();

            while (dr.Read())
            {
                ReservationDM cdm = new ReservationDM();
                cdm.ID              = Convert.ToInt32(dr["ID"]);
                cdm.Date            = Convert.ToDateTime(dr["Date"]);
                cdm.EndDate         = Convert.ToDateTime(dr["EndDate"]);
                cdm.Amount          = Convert.ToInt32(dr["Amount"]);
                cdm.CustomerName    = dr["CustomerName"].ToString();
                cdm.CustomerSurname = dr["CustomerSurname"].ToString();
                cdm.CustomerPhone   = dr["CustomerPhone"].ToString();
                cdm.LicensePlate    = dr["LicensePlate"].ToString();
                cdm.ChassisNumber   = dr["ChassisNumber"].ToString();
                cdm.Marka           = dr["BrandName"].ToString();
                carList.Add(cdm);
            }

            dr.Close();
            utility.endC();
            return(carList);
        }
Beispiel #21
0
        public List <CarDM> getStatusControlCar(int ID, DateTime StartDate, DateTime EndDate)
        {
            List <CarDM> carList = new List <CarDM>();
            DBUtilities  utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_StatusControl";
            utility.cmd.Parameters.Add("CarID", ID);
            utility.cmd.Parameters.Add("StartDate", StartDate);
            utility.cmd.Parameters.Add("EndDate", EndDate);
            utility.cmd.ExecuteScalar();
            SqlDataReader dr = utility.cmd.ExecuteReader();

            while (dr.Read())
            {
                CarDM cdm = new CarDM();
                cdm.ID     = Convert.ToInt32(dr["ID"]);
                cdm.status = dr["Status"].ToString();
                carList.Add(cdm);
            }

            dr.Close();
            utility.endC();
            return(carList);
        }
Beispiel #22
0
        public List <ReservationDM> GetReservationList()
        {
            List <ReservationDM> reservationList = new List <ReservationDM>();
            DBUtilities          utility         = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_getReservation";
            utility.cmd.ExecuteScalar();
            SqlDataReader dr = utility.cmd.ExecuteReader();

            while (dr.Read())
            {
                ReservationDM cdm = new ReservationDM();
                cdm.ID      = Convert.ToInt32(dr["ID"]);
                cdm.Day     = Convert.ToInt32(dr["Day"]);
                cdm.Date    = Convert.ToDateTime(dr["Date"]);
                cdm.EndDate = Convert.ToDateTime(dr["EndDate"]);
                cdm.Amount  = Convert.ToInt32(dr["Amount"]);
                reservationList.Add(cdm);
            }

            dr.Close();
            utility.endC();
            return(reservationList);
        }
Beispiel #23
0
        private static IEnumerable <GreetingRuleDetail> GetGreetingRuleDetails()
        {
            var server   = new Server("localhost");
            var database = DBUtilities.GetAllDatabases(server)
                           .FirstOrDefault(db => db.Name.ToUpper() == "PLAYGROUND");

            return(DBUtilities.GetGreetingRules(database));
        }
Beispiel #24
0
 public EmployeeEditForm(int employeeId)
 {
     InitializeComponent();
     dbUtilitiesCon = new DBUtilities();
     LoadGender();
     GetEmployeeFromDB(employeeId);
     ValidateControls();
 }
Beispiel #25
0
 public EditDepartamentForm(int departamentId)
 {
     InitializeComponent();
     dbUtilitiesCon = new DBUtilities();
     LoadEmployee();
     LoadParentDepartament();
     GetDepartamentFromDB(departamentId);
 }
        /// <summary>
        /// Gets the equity order detail from database
        /// </summary>
        /// <param name="orderExchangeRef">order reference to get details for</param>
        /// <returns>true if record found, false otherwise</returns>
        private bool GetOrderRecordFromDatabase(string orderExchangeRef)
        {
            bool doesOrderRecordExist = false;

            DBLibrary   dbLib       = new DBLibrary();
            DBUtilities dbUtilities = new DBUtilities();

            try
            {
                ArrayList paramList = new ArrayList
                {
                    dbUtilities.CreateSqlParamater("@orderRef", SqlDbType.VarChar, 50,
                                                   ParameterDirection.Input, orderExchangeRef)
                };

                // Query the database for an orderRecord with given orderRecordId
                DataSet ds = dbLib.ExecuteProcedureDS("sp_select_st_derivatives_orderbook", paramList);

                if (ds != null &&
                    ds.Tables != null &&
                    ds.Tables.Count > 0)
                {
                    DataTable dt = ds.Tables[0];

                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];

                        // Get StockOrderBookRecord data
                        OrderDate          = DateTime.Parse(dr["order_date"].ToString());
                        ContractName       = dr["contract_name"].ToString();
                        Direction          = (OrderDirection)Enum.Parse(typeof(OrderDirection), dr["direction"].ToString());
                        Quantity           = int.Parse(dr["qty"].ToString());
                        Price              = double.Parse(dr["price"].ToString());
                        OrderRefenceNumber = dr["order_ref"].ToString();
                        Exchange           = (Exchange)Enum.Parse(typeof(Exchange), dr["exchange"].ToString());
                        OrderStatus        = (OrderStatus)Enum.Parse(typeof(OrderStatus), dr["order_status"].ToString());
                        OpenQty            = int.Parse(dr["qty_open"].ToString());
                        ExecutedQty        = int.Parse(dr["qty_executed"].ToString());
                        ExpiredQty         = int.Parse(dr["qty_expired"].ToString());
                        CancelledQty       = int.Parse(dr["qty_cancelled"].ToString());
                        StopLossPrice      = double.Parse(dr["stoploss_price"].ToString());
                        UpdatedAt          = DateTime.Parse(dr["status_update_time"].ToString());
                        AlgoId             = int.Parse(dr["algo_id"].ToString());

                        doesOrderRecordExist = true;
                    }
                }
            }
            catch (Exception ex)
            {
                // If we failed, trace the error for log analysis
                Logger.LogException(ex);
                throw;
            }

            return(doesOrderRecordExist);
        }
        public ArrayList DbParamListForInsert()
        {
            ArrayList paramList = new ArrayList();

            DBUtilities dbUtilities = new DBUtilities();

            paramList.Add(dbUtilities.CreateSqlParamater("@property_id", SqlDbType.NVarChar, 50, ParameterDirection.Input, this.property_id));
            paramList.Add(dbUtilities.CreateSqlParamater("@project_name", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.project_name)));
            paramList.Add(dbUtilities.CreateSqlParamater("@project_id", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.project_id)));
            paramList.Add(dbUtilities.CreateSqlParamater("@project_url", SqlDbType.NVarChar, 100, ParameterDirection.Input, GetDBValue(this.project_url)));
            paramList.Add(dbUtilities.CreateSqlParamater("@area_id", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.area_id)));
            paramList.Add(dbUtilities.CreateSqlParamater("@area_name", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.area_name)));
            paramList.Add(dbUtilities.CreateSqlParamater("@city", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.city)));
            paramList.Add(dbUtilities.CreateSqlParamater("@property_description", SqlDbType.NVarChar, 256, ParameterDirection.Input, GetDBValue(this.property_description)));
            paramList.Add(dbUtilities.CreateSqlParamater("@title", SqlDbType.NVarChar, 100, ParameterDirection.Input, GetDBValue(this.title)));
            paramList.Add(dbUtilities.CreateSqlParamater("@about_project", SqlDbType.NVarChar, 100, ParameterDirection.Input, GetDBValue(this.about_project)));
            paramList.Add(dbUtilities.CreateSqlParamater("@property_type", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.property_type)));
            paramList.Add(dbUtilities.CreateSqlParamater("@unit_type", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.unit_type)));


            paramList.Add(dbUtilities.CreateSqlParamater("@floor_number", SqlDbType.Int, ParameterDirection.Input, GetDBValue(this.floor_number)));
            paramList.Add(dbUtilities.CreateSqlParamater("@bed_rooms", SqlDbType.Decimal, ParameterDirection.Input, GetDBValue(this.bed_rooms)));
            paramList.Add(dbUtilities.CreateSqlParamater("@bath_rooms", SqlDbType.Int, ParameterDirection.Input, GetDBValue(this.bath_rooms)));
            paramList.Add(dbUtilities.CreateSqlParamater("@balconies", SqlDbType.Int, ParameterDirection.Input, GetDBValue(this.balconies)));
            paramList.Add(dbUtilities.CreateSqlParamater("@area_carpet", SqlDbType.Int, ParameterDirection.Input, GetDBValue(this.area_carpet)));
            paramList.Add(dbUtilities.CreateSqlParamater("@area_builtup", SqlDbType.Int, ParameterDirection.Input, GetDBValue(this.area_builtup)));
            paramList.Add(dbUtilities.CreateSqlParamater("@rent_monthly", SqlDbType.Int, ParameterDirection.Input, GetDBValue(this.rent_monthly)));
            paramList.Add(dbUtilities.CreateSqlParamater("@deposit_amount", SqlDbType.Int, ParameterDirection.Input, GetDBValue(this.deposit_amount)));
            paramList.Add(dbUtilities.CreateSqlParamater("@property_age_years", SqlDbType.Int, ParameterDirection.Input, GetDBValue(this.property_age_years)));
            paramList.Add(dbUtilities.CreateSqlParamater("@total_floors", SqlDbType.Int, ParameterDirection.Input, GetDBValue(this.total_floors)));

            paramList.Add(dbUtilities.CreateSqlParamater("@facing", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.facing)));
            paramList.Add(dbUtilities.CreateSqlParamater("@area_unit_type", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.area_unit_type)));
            paramList.Add(dbUtilities.CreateSqlParamater("@flooring_type", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.flooring_type)));
            paramList.Add(dbUtilities.CreateSqlParamater("@intent", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.intent)));
            paramList.Add(dbUtilities.CreateSqlParamater("@ownership", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.ownership)));
            paramList.Add(dbUtilities.CreateSqlParamater("@is_negotiable", SqlDbType.NVarChar, 10, ParameterDirection.Input, GetDBValue(this.is_negotiable)));
            paramList.Add(dbUtilities.CreateSqlParamater("@bachelors_allowed", SqlDbType.NVarChar, 10, ParameterDirection.Input, GetDBValue(this.bachelors_allowed)));
            paramList.Add(dbUtilities.CreateSqlParamater("@furnish_state", SqlDbType.NVarChar, 50, ParameterDirection.Input, GetDBValue(this.furnish_state)));
            paramList.Add(dbUtilities.CreateSqlParamater("@two_wheeler_parking", SqlDbType.NVarChar, 10, ParameterDirection.Input, GetDBValue(this.two_wheeler_parking)));
            paramList.Add(dbUtilities.CreateSqlParamater("@four_wheeler_parking", SqlDbType.NVarChar, 10, ParameterDirection.Input, GetDBValue(this.four_wheeler_parking)));
            paramList.Add(dbUtilities.CreateSqlParamater("@address", SqlDbType.NVarChar, 100, ParameterDirection.Input, GetDBValue(this.address)));
            paramList.Add(dbUtilities.CreateSqlParamater("@source_system", SqlDbType.NVarChar, 30, ParameterDirection.Input, GetDBValue(this.source_system)));
            paramList.Add(dbUtilities.CreateSqlParamater("@record_type", SqlDbType.NVarChar, 20, ParameterDirection.Input, GetDBValue(this.record_type)));
            paramList.Add(dbUtilities.CreateSqlParamater("@added_by_type", SqlDbType.NVarChar, 20, ParameterDirection.Input, GetDBValue(this.added_by_type)));
            paramList.Add(dbUtilities.CreateSqlParamater("@added_by_name", SqlDbType.NVarChar, 20, ParameterDirection.Input, GetDBValue(this.added_by_name)));
            paramList.Add(dbUtilities.CreateSqlParamater("@contact_person_type", SqlDbType.NVarChar, 20, ParameterDirection.Input, GetDBValue(this.contact_person_type)));
            paramList.Add(dbUtilities.CreateSqlParamater("@latitude", SqlDbType.NVarChar, 20, ParameterDirection.Input, GetDBValue(this.latitude)));
            paramList.Add(dbUtilities.CreateSqlParamater("@longitude", SqlDbType.NVarChar, 20, ParameterDirection.Input, GetDBValue(this.longitude)));

            //contact_person_type

            paramList.Add(dbUtilities.CreateSqlParamater("@possession_from", SqlDbType.DateTime, ParameterDirection.Input, GetDBValue(this.possession_from)));
            paramList.Add(dbUtilities.CreateSqlParamater("@added_on", SqlDbType.DateTime, ParameterDirection.Input, GetDBValue(this.added_on)));

            return(paramList);
        }
Beispiel #28
0
        public void DeleteExam(int ID)
        {
            DBUtilities utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "DELETE FROM Questions WHERE ID = " + ID;
            utility.cmd.ExecuteScalar();
            utility.endC();
        }
Beispiel #29
0
        public void DeleteReservation(int ID)
        {
            DBUtilities utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_DeleteReservation";
            utility.cmd.Parameters.Add("ID", ID);
            utility.cmd.ExecuteScalar();
            utility.endC();
        }
Beispiel #30
0
        public QuestionsModel DetailExam(int ID)
        {
            DBUtilities utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "Select * From Questions WHERE ID = " + ID;
            utility.cmd.ExecuteScalar();
            SqliteDataReader dr  = utility.cmd.ExecuteReader();
            QuestionsModel   odm = new QuestionsModel();

            while (dr.Read())
            {
                odm.ID          = Convert.ToInt32(dr["ID"]);
                odm.Topic       = dr["Topic"].ToString().Trim();
                odm.Description = dr["Description"].ToString().Trim();
                odm.Questions1  = dr["Question1"].ToString().Trim();
                odm.Questions2  = dr["Question1"].ToString().Trim();
                odm.Questions3  = dr["Question1"].ToString().Trim();
                odm.Questions4  = dr["Question1"].ToString().Trim();


                odm.ReplyA1 = dr["A1"].ToString().Trim();
                odm.ReplyA2 = dr["A2"].ToString().Trim();
                odm.ReplyA3 = dr["A3"].ToString().Trim();
                odm.ReplyA4 = dr["A4"].ToString().Trim();


                odm.ReplyB1 = dr["B1"].ToString().Trim();
                odm.ReplyB2 = dr["B2"].ToString().Trim();
                odm.ReplyB3 = dr["B3"].ToString().Trim();
                odm.ReplyB4 = dr["B4"].ToString().Trim();


                odm.ReplyC1 = dr["C1"].ToString().Trim();
                odm.ReplyC2 = dr["C2"].ToString().Trim();
                odm.ReplyC3 = dr["C3"].ToString().Trim();
                odm.ReplyC4 = dr["C4"].ToString().Trim();


                odm.ReplyD1 = dr["D1"].ToString().Trim();
                odm.ReplyD2 = dr["D2"].ToString().Trim();
                odm.ReplyD3 = dr["D3"].ToString().Trim();
                odm.ReplyD4 = dr["D4"].ToString().Trim();


                odm.TrueReply1 = dr["True1"].ToString().Trim();
                odm.TrueReply2 = dr["True2"].ToString().Trim();
                odm.TrueReply3 = dr["True3"].ToString().Trim();
                odm.TrueReply4 = dr["True4"].ToString().Trim();
            }

            utility.endC();

            return(odm);
        }