Example #1
0
        public async Task <IActionResult> EditLine(string strEntidad, string strOt, string strPresupuesto, string strNivel1, string strNivel2, string strNivel3, string strNivel4, string strNivel5, string strNivel6, string strNivel7, string strCalendario, string strHoraInicio, string strMinutoInicio, string strHoraFin, string strMinutoFin, string bHorasViaje, string bGastos, string strParte, string strPernoctacion, string strObservaciones, string strPreslin, string strGastos, string strMessage, string strIdLinea, string strIdUser, string SaveAndValidate, string Save, string Validate)
        {
            _idAldakinUser = await _iApplicationUserAldakin.GetIdUserAldakin(HttpContext.User);

            string strAction    = string.Empty;
            var    dataEditLine = new WorkerLineData
            {
                iIdUsuario        = _idAldakinUser,
                strEntidad        = strEntidad,
                strOt             = strOt,
                strPresupuesto    = strPresupuesto,
                strNivel1         = strNivel1,
                strNivel2         = strNivel2,
                strNivel3         = strNivel3,
                strNivel4         = strNivel4,
                strNivel5         = strNivel5,
                strNivel6         = strNivel6,
                strNivel7         = strNivel7,
                strCalendario     = strCalendario,
                strHoraInicio     = strHoraInicio,
                strMinutoInicio   = strMinutoInicio,
                strHoraFin        = strHoraFin,
                strMinutoFin      = strMinutoFin,
                bHorasViaje       = bHorasViaje,
                bGastos           = bGastos,
                strParte          = strParte,
                strPernoctacion   = strPernoctacion,
                strObservaciones  = strObservaciones,
                strPreslin        = strPreslin,
                strGastos         = strGastos,
                strMensaje        = strMessage,
                strIdlineaAntigua = strIdLinea,
                strAction         = strAction
            };
            //var oReturn = await _IWriteDataBase.EditWorkerLineAsync(dataEditLine, _idAldakinUser);

            var strReturn = await _iWorkPartInformation.PrepareWorkLineAsync(dataEditLine, _idAldakinUser, _idAldakinUser, "edit");



            if (string.IsNullOrEmpty(strReturn))
            {
                return(RedirectToAction("Index", new { strMessage = strReturn, strDate = strCalendario, strAction = "" }));
            }
            else
            {
                return(RedirectToAction("Index", new { strMessage = strReturn, strDate = strCalendario, strAction = "loadWeek" }));
            }
        }
        public async Task <IActionResult> InsertLine(string strEntidad, string strOt, string strPresupuesto, string strNivel1, string strNivel2, string strNivel3, string strNivel4, string strNivel5, string strNivel6, string strNivel7, string strCalendario, string strHoraInicio, string strMinutoInicio, string strHoraFin, string strMinutoFin, string bHorasViaje, string bGastos, string strParte, string strPernoctacion, string strObservaciones, string strPreslin, string strGastos)
        {
            var strReturn = string.Empty;

            _idAldakinUser = await _IApplicationUserAldakin.GetIdUserAldakin(HttpContext.User);

            var dataToInsertLine = new WorkerLineData
            {
                strIdLinea        = "0",
                strEntidad        = strEntidad,
                strOt             = strOt,
                strPresupuesto    = strPresupuesto,
                iIdUsuario        = _idAldakinUser,
                strNivel1         = strNivel1,
                strNivel2         = strNivel2,
                strNivel3         = strNivel3,
                strNivel4         = strNivel4,
                strNivel5         = strNivel5,
                strNivel6         = strNivel6,
                strNivel7         = strNivel7,
                strCalendario     = strCalendario,
                strHoraInicio     = strHoraInicio,
                strMinutoInicio   = strMinutoInicio,
                strHoraFin        = strHoraFin,
                strMinutoFin      = strMinutoFin,
                bHorasViaje       = bHorasViaje,
                bGastos           = bGastos,
                strParte          = strParte,
                strPernoctacion   = strPernoctacion,
                strObservaciones  = strObservaciones,
                strPreslin        = strPreslin,
                strIdlineaAntigua = "0",
                strGastos         = strGastos
            };

            //strReturn = await MainDataApi.InsertLine(dataToInsertLine);
            strReturn = await _IWorkPartInformation.PrepareWorkLineAsync(dataToInsertLine, _idAldakinUser, 0, "insert");

            //strReturn = await _IWriteDataBase.InsertWorkerLineAsync(dataToInsertLine, _idAldakinUser);
            return(RedirectToAction("Index", new { strMessage = strReturn }));
        }
        public async Task <IActionResult> EditLine(string strEntidad, string strOt, string strPresupuesto, string strNivel1, string strNivel2, string strNivel3, string strNivel4, string strNivel5, string strNivel6, string strNivel7, string strCalendario, string strHoraInicio, string strMinutoInicio, string strHoraFin, string strMinutoFin, string bHorasViaje, string bGastos, string strParte, string strPernoctacion, string strObservaciones, string strPreslin, string strGastos, string strMessage, string strIdLinea, string strIdUser, string SaveAndValidate, string Save, string Validate)
        {
            var strReturn = string.Empty;

            _idAldakinUser = await _iApplicationUserAldakin.GetIdUserAldakin(HttpContext.User);

            string strAction = string.Empty;

            // SaveAndValidate,string Save,string Validate
            if (!(string.IsNullOrEmpty(SaveAndValidate)))
            {
                strAction = "SaveAndValidate";
            }
            else
            {
                if (!(string.IsNullOrEmpty(Save)))
                {
                    strAction = "Save";
                }
                else
                {
                    if (!(string.IsNullOrEmpty(Validate)))
                    {
                        strAction = "Validate";
                    }
                    else
                    {
                        strAction = string.Empty;
                    }
                }
            }
            var dataEditLine = new WorkerLineData
            {
                iIdUsuario        = Convert.ToInt32(strIdUser),
                strEntidad        = strEntidad,
                strOt             = strOt,
                strPresupuesto    = strPresupuesto,
                strNivel1         = strNivel1,
                strNivel2         = strNivel2,
                strNivel3         = strNivel3,
                strNivel4         = strNivel4,
                strNivel5         = strNivel5,
                strNivel6         = strNivel6,
                strNivel7         = strNivel7,
                strCalendario     = strCalendario,
                strHoraInicio     = strHoraInicio,
                strMinutoInicio   = strMinutoInicio,
                strHoraFin        = strHoraFin,
                strMinutoFin      = strMinutoFin,
                bHorasViaje       = bHorasViaje,
                bGastos           = bGastos,
                strParte          = strParte,
                strPernoctacion   = strPernoctacion,
                strObservaciones  = strObservaciones,
                strPreslin        = strPreslin,
                strGastos         = strGastos,
                strMensaje        = strMessage,
                strIdlineaAntigua = strIdLinea,
                strAction         = strAction
            };

            //var oReturn = await _IWriteDataBase.EditWorkerLineAsync(dataEditLine, _idAldakinUser);

            strReturn = await _iWorkPartInformation.PrepareWorkLineAsync(dataEditLine, Convert.ToInt32(strIdUser), _idAldakinUser, "edit");

            // strReturn = await _IWriteDataBase.EditWorkerLineAdminAsync(dataToInsertLine);
            return(RedirectToAction("Index", "Search", new { strMessage = strReturn, strAction = "StatusResume", strDate1 = strCalendario, strWorker = strIdUser, strEntity = strEntidad, strOt = 0 }));



            //return RedirectToAction("Index", "Search", new { strMessage = "Parte editado salisfactoriamente",action="StatusResume",strDate1= strCalendario,strWorker= strIdUser });
            //return RedirectToAction("Index", new { strMessage = "aqui" });
            //return RedirectToAction("Index", new { strMessage = strMessage, action = strAction, strDate1 = oReturn.strValue, strEntity = Convert.ToString(oReturn.iValue) });
        }