Ejemplo n.º 1
0
        public void UpdateJob(int id, JobModel model, float circul)
        {
            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString("GyrodataTracker")))
            {
                var p = new DynamicParameters();
                p.Add("@oldJobCirculation", circul);

                p.Add("@Id", id);
                p.Add("@JobNumber", model.JobNumber);
                p.Add("@Client", model.ClientName);
                p.Add("@gdp", model.GDP);
                p.Add("@modem", model.Modem);
                p.Add("@ModemVersion", model.ModemVersion);
                p.Add("@bbp", model.Bullplug);
                p.Add("@newJobCirculation", model.CirculationHours);
                p.Add("@Battery", model.Battery);
                p.Add("@MaxTemp", model.MaxTemp);
                p.Add("@EngineerOne", model.EngineerOne);
                p.Add("@EngineerTwo", model.EngineerTwo);
                p.Add("@EngineerOneArrived", model.eng_one_arrived);
                p.Add("@EngineerTwoArrived", model.eng_two_arrived);
                p.Add("@EngineerOneLeft", model.eng_one_left);
                p.Add("@EngineerTwoLeft", model.eng_two_left);
                p.Add("@Container", model.Container);
                p.Add("@ContainerArrived", model.ContainerArrived);
                p.Add("@ContainerLeft", model.ContainerLeft);
                p.Add("@Rig", model.Rig);
                p.Add("@Issues", model.Issues);
                p.Add("@Comment", model.Comment);

                //p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);

                connection.Execute("dbo.spUpdate_Job", p, commandType: CommandType.StoredProcedure);

                //model.Id = p.Get<int>("@Id");

                //return model;
            }
        }
Ejemplo n.º 2
0
        // Creating Job record in DB
        public JobModel CreateJob(JobModel model)
        {
            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString("GyrodataTracker")))
            {
                var p = new DynamicParameters();
                p.Add("@JobNumber", model.JobNumber);
                p.Add("@Client", model.ClientName);
                p.Add("@GDPAsset", model.GDP);
                p.Add("@ModemAsset", model.Modem);
                p.Add("@ModemVersion", model.ModemVersion);
                p.Add("@BullplugAsset", model.Bullplug);
                p.Add("@CirculationHours", model.CirculationHours);
                p.Add("@Battery", model.Battery);
                p.Add("@MaxTemp", model.MaxTemp);
                p.Add("@EngineerOne", model.EngineerOne);
                p.Add("@EngineerTwo", model.EngineerTwo);
                p.Add("@EngineerOneArrived", model.eng_one_arrived);
                p.Add("@EngineerTwoArrived", model.eng_two_arrived);
                p.Add("@EngineerOneLeft", model.eng_two_arrived);
                p.Add("@EngineerTwoLeft", model.eng_two_left);
                p.Add("@Container", model.Container);
                p.Add("@ContainerArrived", model.ContainerArrived);
                p.Add("@ContainerLeft", model.ContainerLeft);
                p.Add("@Rig", model.Rig);
                p.Add("@Issues", model.Issues);
                p.Add("@Comment", model.Comment);

                p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);

                connection.Execute("dbo.spJob_Insert", p, commandType: CommandType.StoredProcedure);

                model.Id = p.Get <int>("@Id");

                return(model);
            }
        }