Ejemplo n.º 1
0
        protected void gridArtifacts_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxGridView gridArtifacts  = (ASPxGridView)sender;
            ASPxGridView gridRepository = (ASPxGridView)gridArtifacts.FindEditFormLayoutItemTemplateControl("gridRepository");


            //Use class AttachmentList to create a list of artifacts to be attached
            AttachmentList xMultiAttachment = new AttachmentList();

            //go through grid and create an unit for each selected item
            for (int i = 0; i <= gridRepository.VisibleRowCount; i = i + 1)
            {
                if (gridRepository.Selection.IsRowSelected(i) == true)
                {
                    //get page ref from text box inside cell template
                    ASPxTextBox txPage = (ASPxTextBox)gridRepository.FindRowCellTemplateControl(i, gridRepository.DataColumns[8], "txPage");
                    xMultiAttachment.Add(new Attachment()
                    {
                        ArtifactID    = gridRepository.GetRowValues(i, "ArtifactID").ToString(),
                        ProjectID     = gridRepository.GetRowValues(i, "ProjectID").ToString(),
                        PageReference = txPage.Text.ToString(),
                        ItemID        = Session["ItemKey"].ToString()
                    });
                }
            }
            //If any selected, call the function in rc_services to attach multiple artifacts
            if (xMultiAttachment.Count > 0)
            {
                string xMultiAttachResult = rc_services.AttachArtifact(xMultiAttachment);
                e.Cancel = true;
                gridArtifacts.CancelEdit();
                gridArtifacts.DataBind();
                gridRepository.Selection.UnselectAll();
            }
        }
Ejemplo n.º 2
0
        protected void DELSGridView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            DELSDataTable = (DataTable)Session["DELStable"];


            ASPxTextBox  txtKeyword            = (ASPxTextBox)DELSGridView.FindEditFormTemplateControl("LogFileTextBox");
            ASPxTextBox  txtNotRequiredKeyword = (ASPxTextBox)DELSGridView.FindEditFormTemplateControl("NotLogFileTextBox");
            ASPxCheckBox LogFileCheckBox       = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("LogFileCheckBox");
            ASPxCheckBox logCheckBox           = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("logCheckBox");
            ASPxCheckBox AgentlogCheckBox      = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("AgentlogCheckBox");

            //UpdateEventMasterData("Insert", GetRow(DELSDataTable, e.NewValues.GetEnumerator(), -1));
            try
            {
                if (Session["DELStable"] != null && Session["DELStable"] != "")
                {
                    DELSDataTable = Session["DELStable"] as DataTable;
                }
                ASPxGridView gridView = (ASPxGridView)sender;

                UpdateData("Insert", GetRow(DELSDataTable, e.NewValues.GetEnumerator(), 0));

                gridView.CancelEdit();
                e.Cancel = true;

                FillDELSGridfromSession();
            }
            catch (Exception ex)
            {
                errorDiv.InnerHtml = msgloc.ToString() +
                                     "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                errorDiv.Style.Value = "display: block";
            }
        }
Ejemplo n.º 3
0
        protected void ELSGridView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ELSDataTable = (DataTable)Session["ELS"];

            ASPxGridView gridView = (ASPxGridView)sender;

            UpdateEventMasterData("Insert", GetRow(ELSDataTable, e.NewValues.GetEnumerator(), -1));
            gridView.CancelEdit();
            e.Cancel = true;

            errorDiv.InnerHtml = msgloc.ToString() +
                                 "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
            errorDiv.Style.Value = "display: block";
            FillELSGrid();
        }
Ejemplo n.º 4
0
        protected void ASPxGridViewUsers_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            if (IsValid)
            {
                var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
                var user    = new ApplicationUser()
                {
                    Name = e.NewValues["Name"].ToString(), UserName = e.NewValues["UserName"].ToString(), Email = e.NewValues["UserName"].ToString(), TypeUser = e.NewValues["TypeUser"].ToString()
                };
                IdentityResult result = manager.Create(user, e.NewValues["PasswordHash"].ToString());
                if (result.Succeeded)
                {
                    // Para obtener más información sobre cómo habilitar la confirmación de cuentas y el restablecimiento de contraseña, visite http://go.microsoft.com/fwlink/?LinkID=320771
                    //string code = manager.GenerateEmailConfirmationToken(user.Id);
                    //string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request);
                    //manager.SendEmail(user.Id, "Confirmar cuenta", "Para confirmar la cuenta, haga clic <a href=\"" + callbackUrl + "\">aquí</a>.");

                    //se obtiene el valor del rol seleccionado
                    //ASPxComboBox editor = (ASPxComboBox)ASPxGridViewUsers.FindEditFormTemplateControl("cmbUserType");
                    //string grupo = editor.Text;

                    string[] x = GetLookupCompanies();

                    //se valida si existe el rol de usuario
                    var _context    = new ApplicationDbContext();
                    var roleStore   = new RoleStore <IdentityRole>(_context);
                    var roleManager = new RoleManager <IdentityRole>(roleStore);
                    if (!roleManager.RoleExists(e.NewValues["TypeUser"].ToString()))
                    {
                        _context.Roles.Add(new IdentityRole(e.NewValues["TypeUser"].ToString()));
                    }

                    //se agrega el usuario al Rol seleccionado
                    manager.AddToRole(user.Id, e.NewValues["TypeUser"].ToString());

                    ASPxGridViewUsers.JSProperties.Add("cp_success", "true");
                }
                else
                {
                    ASPxGridViewUsers.JSProperties.Add("cp_success", "false");
                }
            }

            e.Cancel = true;
            ASPxGridViewUsers.CancelEdit();
            GetUserList();
        }
Ejemplo n.º 5
0
        protected void gridFrontMatter_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxHtmlEditor txtDescription = (ASPxHtmlEditor)gridFrontMatter.FindEditFormLayoutItemTemplateControl("txtDescription");
            FrontMatter    NewFrontMatter = new FrontMatter();

            NewFrontMatter.ProjectID   = Guid.Parse(Session["projectID"].ToString());
            NewFrontMatter.Name        = e.NewValues["Name"].ToString();
            NewFrontMatter.Description = txtDescription.Html;



            rtm_services.NewFrontMatter(NewFrontMatter);
            e.Cancel = true;
            var projectId = Session["projectID"].ToString();

            gridFrontMatter.DataSource = rtm_services.GetFrontMatter(projectId);
            gridFrontMatter.DataBind();
            gridFrontMatter.CancelEdit();
        }
Ejemplo n.º 6
0
        protected void gridWorkflow_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            String         ItemKey      = Session["ItemKey"].ToString();
            ASPxGridView   gridWorkflow = (ASPxGridView)sender;
            ASPxComboBox   dropStatus   = (ASPxComboBox)gridWorkflow.FindEditFormLayoutItemTemplateControl("workflowDropStatus");
            ASPxComboBox   dropUser     = (ASPxComboBox)gridWorkflow.FindEditFormLayoutItemTemplateControl("workflowdropUser");
            ASPxHtmlEditor txComments   = (ASPxHtmlEditor)gridWorkflow.FindEditFormLayoutItemTemplateControl("txComments");

            Workflow NewStatus = new Workflow
            {
                ItemKey     = Guid.Parse(ItemKey),
                ProjectID   = Guid.Parse(Session["projectID"].ToString()),
                Status      = dropStatus.Text,
                StatusValue = Convert.ToInt32(dropStatus.Value.ToString()),
                Comments    = txComments.Html,
                WorkerID    = (dropUser.Value == null) ? Guid.Empty : Guid.Parse(dropUser.Value.ToString()),
                ManagerID   = Guid.Parse(rc_services.GetUserID()),
                DueDate     = Convert.ToDateTime(e.NewValues[0]),
                StatusDate  = DateTime.Now
            };

            var           item        = rc_services.GetItemName(ItemKey);
            string        worker      = dropUser.Text.ToString();
            Guid          WorkerID    = (dropUser.Value == null) ? Guid.Empty : Guid.Parse(dropUser.Value.ToString());
            string        manager     = HttpContext.Current.Session["UserEmail"].ToString();
            string        projectName = HttpContext.Current.Session["ProjectName"].ToString();
            string        Status      = dropStatus.Text;
            List <string> ListItems   = new List <string>();

            rc_services.WorkFlowNotificationEmail(WorkerID, worker, manager, projectName, Status, ListItems, item);

            rc_services.NewWorkflowStatus(NewStatus);
            e.Cancel = true;
            Guid projectID = Guid.Parse(Session["projectID"].ToString());

            gridWorkflow.DataSource = rc_services.GetWorkflow(Guid.Parse(ItemKey), projectID);
            gridWorkflow.DataBind();
            gridWorkflow.CancelEdit();
        }
Ejemplo n.º 7
0
        protected void gridResponse_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            String         ItemID       = Session["ItemKey"].ToString();
            ASPxGridView   gridResponse = (ASPxGridView)sender;
            ASPxHtmlEditor txResponse   = (ASPxHtmlEditor)gridResponse.FindEditFormLayoutItemTemplateControl("txResponse");
            Guid           Milestoneid  = Guid.Parse(e.NewValues["MilestoneName"].ToString());

            AssessmentResponse NewResponse = new AssessmentResponse
            {
                MilestoneID = Guid.Parse(e.NewValues["MilestoneName"].ToString()),
                ItemKey     = Guid.Parse(ItemID),

                Response = txResponse.Html
            };

            rc_services.InsertNewResponse(NewResponse);
            e.Cancel = true;
            gridResponse.DataSource = rc_services.GetResponse(Guid.Parse(ItemID));
            gridResponse.DataBind();
            gridResponse.CancelEdit();

            BindMainGrids();
        }
Ejemplo n.º 8
0
        protected void gridChannels_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            try
            {
                SessionManager.IsEditFormCreated = false;
                int newChannelType = int.Parse(Utilities.GetEditFormComboValue(gridChannels, "cmbEfType").ToString());
                int newInfoType    = int.Parse(Utilities.GetEditFormComboValue(gridChannels, "cmbEfInfoType").ToString());
                if ((newChannelType != 0) && (newInfoType != 0))
                {
                    //update channel
                    CanonChannel cc = new CanonChannel();
                    cc.ChannelName = e.NewValues["ChannelName"].ToString();
                    cc.ChannelType = newChannelType;
                    cc.InfoType    = newInfoType;
                    if (e.NewValues["IsActive"] != null)
                    {
                        cc.IsActive = (bool)e.NewValues["IsActive"];
                    }
                    else
                    {
                        cc.IsActive = false;
                    }
                    cc.Url         = e.NewValues["Url"].ToString();
                    cc.ReportingTo = e.NewValues["ReportingTo"].ToString();
                    CanonChannel.InsertChannel(cc);
                }

                e.Cancel = true;
                gridChannels.CancelEdit();
                this.BindData();
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error);
            }
        }
Ejemplo n.º 9
0
 protected void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
 {
     InsertNewWCItem(e.NewValues);
     CancelWCEditing(e);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// RowInserting event on grid view. All we need to do here is supplying foreign key value that can be
 /// inferred from master grid view.
 /// </summary>
 /// <param name="sender">Grid view sending the event.</param>
 /// <param name="e">Event args containing new data to be inserted.</param>
 void detailGrid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
 {
     e.NewValues[foreignKey.Name] = (sender as ASPxGridView).GetMasterRowKeyValue();
 }