/// <summary>
        /// Save all sections & works to database (direct)
        /// </summary>
        /// <param name="id">id</param>
        /// <param name="companyId">companyId</param>
        public void Save(Guid id, int companyId)
        {
            FlatSectionJlinerTDS jlinerChanges = (FlatSectionJlinerTDS)Data.GetChanges();

            if (jlinerChanges.JuntionLiner2History.Rows.Count > 0)
            {
                FlatSectionJlinerJuntionLiner2HistoryGateway flatSectionJlinerJuntionLiner2HistoryGateway = new FlatSectionJlinerJuntionLiner2HistoryGateway(jlinerChanges);

                foreach (FlatSectionJlinerTDS.JuntionLiner2HistoryRow row in (FlatSectionJlinerTDS.JuntionLiner2HistoryDataTable)jlinerChanges.JuntionLiner2History)
                {
                    // Insert new comments
                    if ((!row.Deleted) && (!row.InDatabase))
                    {
                        JlinerHistory jlinerHistory = new JlinerHistory(null);
                        jlinerHistory.InsertDirect(row.ID, row.RefID, companyId, row.HistoryID, row.DateTime_, row.LoginID, row.History, row.Deleted);
                    }

                    // Update comments
                    if ((!row.Deleted) && (row.InDatabase))
                    {
                        int refId = row.RefID;
                        int historyId = row.HistoryID;

                        // original values
                        int originalLoginId = flatSectionJlinerJuntionLiner2HistoryGateway.GetLoginIDOriginal(id, refId, companyId, historyId);
                        DateTime? originalDateTime = null; if (flatSectionJlinerJuntionLiner2HistoryGateway.GetDateTime_Original(id, refId, companyId, historyId) != null) originalDateTime = flatSectionJlinerJuntionLiner2HistoryGateway.GetDateTime_Original(id, refId, companyId, historyId);
                        string originalHistory = flatSectionJlinerJuntionLiner2HistoryGateway.GetHistoryOriginal(id, refId, companyId, historyId);

                        // new values
                        string newHistory = flatSectionJlinerJuntionLiner2HistoryGateway.GetComment(id, refId, companyId, historyId);

                        JlinerHistory jlinerHistory = new JlinerHistory(null);
                        jlinerHistory.UpdateDirect(id, refId, companyId, historyId, originalDateTime, originalLoginId, originalHistory, false, id, refId, companyId, historyId, originalDateTime, originalLoginId, newHistory, false);
                    }

                    // Deleted lateral comments
                    if (row.Deleted)
                    {
                        JlinerHistory jlinerHistory = new JlinerHistory(null);
                        jlinerHistory.DeleteDirect(row.ID, row.RefID, companyId, row.HistoryID);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// UpdateCommentsHistoryForSummaryEdit
        /// </summary>
        public void UpdateCommentsHistoryForSummaryEdit()
        {
            FlatSectionJlinerJuntionLiner2CommentGateway flatSectionJlinerJuntionLiner2CommentGateway = new FlatSectionJlinerJuntionLiner2CommentGateway();
            FlatSectionJlinerJuntionLiner2Comment jlinerComments = new FlatSectionJlinerJuntionLiner2Comment(flatSectionJlinerJuntionLiner2CommentGateway.Data);

            FlatSectionJlinerJuntionLiner2HistoryGateway flatSectionJlinerJuntionLiner2HistoryGateway = new FlatSectionJlinerJuntionLiner2HistoryGateway();
            FlatSectionJlinerJuntionLiner2History jlinerHistory = new FlatSectionJlinerJuntionLiner2History(flatSectionJlinerJuntionLiner2HistoryGateway.Data);

            foreach (FlatSectionJlinerTDS.FlatSectionJlinerRow row in (FlatSectionJlinerTDS.FlatSectionJlinerDataTable)Table)
            {
                flatSectionJlinerJuntionLiner2CommentGateway.LoadByIdRefId(row.ID, row.RefID, row.COMPANY_ID);
                row.Comments = jlinerComments.GetAllComments(row.ID, row.RefID, row.COMPANY_ID, flatSectionJlinerJuntionLiner2CommentGateway.Table.Rows.Count, "\n");

                flatSectionJlinerJuntionLiner2HistoryGateway.LoadByIdRefId(row.ID, row.RefID, row.COMPANY_ID);
                row.History = jlinerHistory.GetAllHistory(row.ID, row.RefID, row.COMPANY_ID, flatSectionJlinerJuntionLiner2HistoryGateway.Table.Rows.Count, "\n");
            }
        }
コード例 #3
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_APP_VIEW"]) && Convert.ToBoolean(Session["sgLFS_APP_EDIT"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in flat_section_jliner_edit.aspx");
                }

                // Tag page
                hdfCurrentClient.Value = (string)Request.QueryString["client"];
                hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString();
                hdfId.Value = Convert.ToString(Request.QueryString["rowId"]);
                hdfRefId.Value = Convert.ToString(Request.QueryString["rowRefId"]);
                hdfCompanyId.Value = Convert.ToString(Request.QueryString["rowCompanyId"]);
                hdfAdminPermission.Value = Convert.ToBoolean(Session["sgLFS_APP_ADMIN"]).ToString();
                hdfUpdate.Value = "yes";

                // Prepare initial data
                Session.Remove("commentsDummy");

                // ... Names for UserList
                int companyId = Int32.Parse(hdfCompanyId.Value);

                LoginGateway loginGateway = new LoginGateway();
                loginGateway.LoadByLoginId(Convert.ToInt32(hdfLoginId.Value), companyId);
                hdfCreatedBy.Value = loginGateway.GetLastName(Convert.ToInt32(hdfLoginId.Value), companyId) + " " + loginGateway.GetFirstName(Convert.ToInt32(hdfLoginId.Value), companyId);
                hdfCreationDateTime.Value = DateTime.Now.ToString();

                // If comming from
                // ... flat_section_jliner_summary.aspx
                if (Request.QueryString["source_page"] == "flat_section_jliner_summary.aspx" || Request.QueryString["source_page"] == "flat_section_jliner_edit.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];
                    Session["rowFocus"] = Convert.ToInt32(Request.QueryString["rowFocus"].ToString());

                    // ... Load comments to edit
                    sectionTDS = new SectionTDS();
                    flatSectionJlinerTDS = (FlatSectionJlinerTDS)Session["flatSectionJlinerTDS"];

                    SectionGateway sectionGateway = new SectionGateway(sectionTDS);
                    sectionGateway.LoadById(new Guid(hdfId.Value), Convert.ToInt32(hdfCompanyId.Value));

                    JlinerGateway jlinerGateway = new JlinerGateway(sectionTDS);
                    jlinerGateway.LoadByIdCompanyIdRefId(new Guid(hdfId.Value), Convert.ToInt32(hdfCompanyId.Value), Convert.ToInt32(hdfRefId.Value));

                    FlatSectionJlinerJuntionLiner2CommentGateway flatSectionJlinerJuntionLiner2CommentGateway = new FlatSectionJlinerJuntionLiner2CommentGateway(flatSectionJlinerTDS);
                    flatSectionJlinerJuntionLiner2CommentGateway.LoadAllByIdRefId(new Guid(hdfId.Value), Convert.ToInt32(hdfRefId.Value), Convert.ToInt32(hdfCompanyId.Value));

                    FlatSectionJlinerJuntionLiner2Comment flatSectionJlinerJuntionLiner2Comment = new FlatSectionJlinerJuntionLiner2Comment(flatSectionJlinerJuntionLiner2CommentGateway.Data);
                    flatSectionJlinerJuntionLiner2Comment.UpdateForProcess();

                    // ... Load history for transfers
                    FlatSectionJlinerJuntionLiner2HistoryGateway flatSectionJlinerJuntionLiner2HistoryGateway = new FlatSectionJlinerJuntionLiner2HistoryGateway(flatSectionJlinerTDS);
                    flatSectionJlinerJuntionLiner2HistoryGateway.LoadAllByIdRefId(new Guid(hdfId.Value), Convert.ToInt32(hdfRefId.Value), Convert.ToInt32(hdfCompanyId.Value));

                    // ... Store datasets
                    Session["sectionTDS"] = sectionTDS;
                    Session["flatSectionJlinerTDS"] = flatSectionJlinerTDS;
                    comments = flatSectionJlinerTDS.JuntionLiner2Comment;
                    Session["comments"] = comments;
                }
            }
            else
            {
                // Restore datasets
                sectionTDS = (SectionTDS)Session["sectionTDS"];
                flatSectionJlinerTDS = (FlatSectionJlinerTDS)Session["flatSectionJlinerTDS"];
                Session["flatSectionJlinerTDS"] = flatSectionJlinerTDS;
                comments = flatSectionJlinerTDS.JuntionLiner2Comment;
                Session["comments"] = comments;
            }
        }