Пример #1
0
        private bool LoadNavigation(GeneralSessionInfo gsi, SqlConnection con)
        {
            SqlDataAdapter sqlDataAdapter;
            DataSet        dataSet = new DataSet();

            List <Field> ret = new List <Field>();
            SqlCommand   sql = new SqlCommand("GetNavigation", con);

            sql.CommandType = CommandType.StoredProcedure;
            sql.Parameters.Add(new SqlParameter("NavID", Page.SideMenu.NavID));
            sql.Parameters.Add(new SqlParameter("LanguageID", gsi.languageID));
            sql.Parameters.Add(new SqlParameter("UserID", gsi.userID));

            try
            {
                sqlDataAdapter = new SqlDataAdapter(sql);
                sqlDataAdapter.Fill(dataSet);
                if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
                {
                    Page.SideMenu.ProcessNavigation(dataSet.Tables[0]);
                }
                else
                {
                    //Page.GenerateUnknownPageInfo();
                    Console.WriteLine("No matching records found.");
                }
            }
            catch (Exception eee)
            {
                ret.Add(new LabelTextAreaField("1", "Exception in LoadNavigation(..)", eee.ToString()));
            }
            return(false);
        }
Пример #2
0
        private bool LoadPanelsInfo(GeneralSessionInfo gsi, SqlConnection con, int ProjectID, int PageID)
        {
            SqlDataAdapter sqlDataAdapter;
            DataSet        dataSet = new DataSet();

            List <TempMultiSelectItem> AllMultiSelectItem = new List <TempMultiSelectItem>();
            List <Field> ret = new List <Field>();
            SqlCommand   sql = new SqlCommand("GetPanelsInfo", con);

            sql.CommandType = CommandType.StoredProcedure;
            sql.Parameters.Add(new SqlParameter("RetailerID", gsi.retailerID));
            sql.Parameters.Add(new SqlParameter("PageID", PageID));
            sql.Parameters.Add(new SqlParameter("LanguageID", gsi.languageID));

            try
            {
                sqlDataAdapter = new SqlDataAdapter(sql);
                sqlDataAdapter.Fill(dataSet);
                if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
                {
                    Page.ProcessPanelsInfo(dataSet.Tables[0]);
                }
                else
                {
                    Page.GenerateUnknownPageInfo();
                    Console.WriteLine("No matching records found.");
                }
            }
            catch (Exception eee)
            {
                ret.Add(new LabelTextAreaField("1", "Exception in LoadPanelsInfo(..)", eee.ToString()));
            }
            return(false);
        }
Пример #3
0
        public bool SavePage(GeneralSessionInfo gsi, int PageID, IFormCollection fc)
        {
            Project OldProject = new Project(ProjectID);

            OldProject.LoadProjectFromDB(gsi, PageID);
            using (SqlConnection con = new SqlConnection(DBUtil.GetSqlConnectionString()))
            {
                FieldValueUpdateInfo UpdateInfo = new FieldValueUpdateInfo(con, gsi.retailerID, ProjectID, null, gsi.userID);
                OldProject.Page.Panels.SavePanels(fc, UpdateInfo);
            }

            return(false);
        }
Пример #4
0
        public bool LoadProjectFromDB(GeneralSessionInfo gsi, int PageID)
        {
            using (SqlConnection con = new SqlConnection(DBUtil.GetSqlConnectionString()))
            {
                con.Open();

                LoadPageInfo(gsi, con, ProjectID, PageID);
                //LoadNavigation(gsi, con);
                LoadPanelsInfo(gsi, con, ProjectID, PageID);
                LoadPanelsFields(gsi, con, ProjectID, PageID);
            }
            return(false);
        }
Пример #5
0
        private bool LoadPanelsFields(GeneralSessionInfo gsi, SqlConnection con, int ProjectID, int PageID)
        {
            SqlDataAdapter sqlDataAdapter;
            DataSet        dataSet = new DataSet();

            List <TempMultiSelectItem> AllMultiSelectItem = new List <TempMultiSelectItem>();
            List <Field> ret = new List <Field>();
            SqlCommand   sql = new SqlCommand("GetPageFields", con);

            sql.CommandType = CommandType.StoredProcedure;
            sql.Parameters.Add(new SqlParameter("RetailerID", gsi.retailerID));
            sql.Parameters.Add(new SqlParameter("ProjectID", ProjectID));
            sql.Parameters.Add(new SqlParameter("PageID", PageID));
            sql.Parameters.Add(new SqlParameter("LanguageID", gsi.languageID));

            try
            {
                //  http://www.dotnetfunda.com/articles/show/1716/multiple-resultsets-in-sql-server-and-handling-them-in-csharp-part-ii

                sqlDataAdapter = new SqlDataAdapter(sql);
                sqlDataAdapter.Fill(dataSet);
                if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
                {
                    Page.Panels.ProcessFieldsInfo(dataSet.Tables[0]);
                }
                else
                {
                    Page.GenerateUnknownPageInfo();
                    Console.WriteLine("No matching records found.");
                }
                //if (dataSet.Tables.Count > 0)
                //{
                //    if (dataSet.Tables[0].Rows.Count > 0)
                //        Page.ProcessPageInfo(dataSet.Tables[0]);
                //    if (dataSet.Tables[1].Rows.Count > 0)
                //        Page.ProcessPanelsInfo(dataSet.Tables[1]);
                //    if (dataSet.Tables[2].Rows.Count > 0)
                //        Page.Panels.ProcessFieldsInfo(dataSet.Tables[2]);
                //}
            }
            catch (Exception eee)
            {
                ret.Add(new LabelTextAreaField("1", "Exception in LoadPanelContent(..)", eee.ToString()));
            }

            return(false);
        }