Exemplo n.º 1
0
        /// <summary>
        /// Add Dry Run
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public CommonResponseWithIds AddDryRun(DryRunDetails data)
        {
            CommonResponseWithIds obj = new CommonResponseWithIds();

            try
            {
                CommonFunction commonFunction = new CommonFunction();
                string         shift          = commonFunction.GetCurrentShift();
                string         correctedDate  = commonFunction.GetCorrectedDate();

                var roleId = db.UnitworkccsTbloperatordetails.Where(m => m.OpId == data.userId).Select(m => m.RoleId).FirstOrDefault();
                var check  = db.UnitworkccsTbldryrun.Where(m => m.MachineId == data.machineId && m.FgPartId == data.fgPartId && m.EndDate == null && roleId == 11).FirstOrDefault();
                if (check == null)
                {
                    UnitworkccsTbldryrun UnitworkccsTbldryrun = new UnitworkccsTbldryrun();
                    UnitworkccsTbldryrun.FgPartId      = data.fgPartId;
                    UnitworkccsTbldryrun.MachineId     = data.machineId;
                    UnitworkccsTbldryrun.StartDate     = DateTime.Now;
                    UnitworkccsTbldryrun.CreatedOn     = DateTime.Now;
                    UnitworkccsTbldryrun.CorrectedDate = correctedDate;
                    UnitworkccsTbldryrun.IsDeleted     = 0;
                    UnitworkccsTbldryrun.Shift         = shift;
                    db.UnitworkccsTbldryrun.Add(UnitworkccsTbldryrun);
                    db.SaveChanges();
                    obj.isStatus = true;
                    obj.response = ResourceResponse.AddedSuccessMessage;
                    obj.id       = UnitworkccsTbldryrun.DryRunId;
                }
            }
            catch (Exception)
            {
                obj.isStatus = false;
                obj.response = ResourceResponse.FailureMessage;
            }
            return(obj);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddDryRun(DryRunDetails data)
        {
            CommonResponseWithIds response = dryRun.AddDryRun(data);

            return(Ok(response));
        }