Ejemplo n.º 1
0
        public void AddDeploymentFile(ref OperationResult pobjOperationResult, deploymentfileDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;
            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                deploymentfile        objEntity = deploymentfileAssembler.ToEntity(pobjDtoEntity);


                dbContext.AddTodeploymentfile(objEntity);
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "DEPLOYMENT FILE", "DeploymentFileId=" + objEntity.i_DeploymentFileId.ToString(), Success.Ok, null);

                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = ex.Message;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "DEPLOYMENT FILE", "DeploymentFileId=" + pobjDtoEntity.i_DeploymentFileId.ToString(), Success.Failed, ex.Message);
                return;
            }
        }
Ejemplo n.º 2
0
        public deploymentfileDto GetDeploymentFile(ref OperationResult pobjOperationResult, int pintDeploymentFileId)
        {
            //mon.IsActive = true;

            try
            {
                SigesoftEntitiesModel dbContext    = new SigesoftEntitiesModel();
                deploymentfileDto     objDtoEntity = null;

                var objEntity = (from a in dbContext.deploymentfile
                                 where a.i_DeploymentFileId == pintDeploymentFileId
                                 select a).FirstOrDefault();

                if (objEntity != null)
                {
                    objDtoEntity = deploymentfileAssembler.ToDTO(objEntity);
                }

                pobjOperationResult.Success = 1;
                return(objDtoEntity);
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = ex.Message;
                return(null);
            }
        }
Ejemplo n.º 3
0
        private void LoadData()
        {
            OperationResult objOperationResult = new OperationResult();


            objMainEntityDetail            = new List <TestList>();
            Session["objMainEntityDetail"] = objMainEntityDetail;
            //Llenado de combos
            Utils.LoadDropDownList(ddlSoftwareComponentId, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 144), DropDownListAction.Select);
            string Mode = Request.QueryString["Mode"].ToString();

            int DeploymentFileId = 0;


            if (Request.QueryString["i_DeploymentFileId"] != null)
            {
                DeploymentFileId = int.Parse(Request.QueryString["i_DeploymentFileId"].ToString());
            }

            if (Mode == "New")
            {
            }
            else
            {
                txtPackageSizeKb.Visible = true;
                txtPackageFiles.Visible  = true;
                // Get the Entity Data
                deploymentfileDto objEntity = _objSyncBL.GetDeploymentFile(ref objOperationResult, DeploymentFileId);

                // Save the entity on the session
                Session["objEntity"] = objEntity;

                // Show the data on the form
                txtDeploymentFileId.Text             = objEntity.i_DeploymentFileId.ToString();
                txtDeploymentFileId.Enabled          = false;
                ddlSoftwareComponentId.SelectedValue = objEntity.i_SoftwareComponentId.ToString();
                ddlSoftwareComponentId.Enabled       = false;
                txtFileName.Text    = objEntity.v_FileName;
                txtFileName.Enabled = false;
                txtTargetSoftwareComponentVersion.Text    = objEntity.v_TargetSoftwareComponentVersion;
                txtTargetSoftwareComponentVersion.Enabled = false;
                txtDescription.Text      = objEntity.v_Description;
                txtDescription.Enabled   = false;
                txtPackageFiles.Text     = objEntity.v_PackageFiles;
                txtPackageFiles.Enabled  = false;
                txtPackageSizeKb.Text    = objEntity.r_PackageSizeKb.ToString();
                txtPackageSizeKb.Enabled = false;
                filePhoto.Enabled        = false;
                grdData.Enabled          = false;
                btnSaveRefresh.Visible   = false;
            }
        }
Ejemplo n.º 4
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            string          Mode = Request.QueryString["Mode"].ToString();
            OperationResult objOperationResult = new OperationResult();
            List <TestList> objDetailData      = Session["objMainEntityDetail"] as List <TestList>;

            if (Mode == "New")
            {
                // Create the entity
                deploymentfileDto objEntity = new deploymentfileDto();

                objEntity.i_DeploymentFileId               = int.Parse(txtDeploymentFileId.Text.ToString());
                objEntity.i_SoftwareComponentId            = int.Parse(ddlSoftwareComponentId.SelectedValue.ToString());
                objEntity.v_FileName                       = txtFileName.Text.Trim().ToUpper();
                objEntity.i_DeploymentFileId               = int.Parse(txtDeploymentFileId.Text.ToString());
                objEntity.v_TargetSoftwareComponentVersion = txtTargetSoftwareComponentVersion.Text.Trim().ToUpper();
                objEntity.v_Description                    = txtDescription.Text.Trim().ToUpper();

                //Grabar Grilla
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                string        PackageFile    = "";
                List <string> Files          = new List <string>();
                foreach (var item in objDetailData)
                {
                    PackageFile = Path.Combine(Sigesoft.Common.Utils.GetApplicationExecutingFolder(), objEntity.v_FileName);
                    Files.Add(item.v_Path);
                    objEntity.v_PackageFiles = sb.AppendLine(item.v_FileName + " , ").ToString();
                }
                // Crear el archivo comprimido
                Sigesoft.Common.Utils.CompressFile(PackageFile, Files);
                byte[] PackageFileByteArray = Sigesoft.Common.Utils.GetBytesOfFile(PackageFile);
                objEntity.b_FileData      = PackageFileByteArray;
                objEntity.r_PackageSizeKb = PackageFileByteArray.Length;
                // Save the data
                _objSyncBL.AddDeploymentFile(ref objOperationResult, objEntity, ((ClientSession)Session["objClientSession"]).GetAsList());
            }

            //Analizar el resultado de la operación
            if (objOperationResult.Success == 1)  // Operación sin error
            {
                // Cerrar página actual y hacer postback en el padre para actualizar
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else  // Operación con error
            {
                Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage);
                // Se queda en el formulario.
            }
        }