Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CacheUtils.sendNoCache(Response, Session);
            var errMsg = "";
            var ret    = 0;

            #region checkWebConfig
            var webConfig = new WebConfig();
            ret = WebConfigUtils.readWebConfig(ref webConfig, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            if (WebConfigUtils.checkWebConfig(Response, Session, ref webConfig) == false)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            #endregion
            var systemCode = Global.SYSTEM_CODE;
            var ws         = new PASABAHCE_WEB_SERVICE();
            #region checkIfLoggedIn
            errMsg = "";
            var userInfo = new CLS_USER_INFO();
            ret = LoginUtils.checkIfLoggedIn(ws, webConfig, Session, Response, ref userInfo, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            if (userInfo.USER_ID == "")
            {
                Response.Redirect("~/Account/LoginForm.aspx", true);
                return;
            }
            int    PAGE_ID;
            string PAGE_NAME = "ProductionWorkPlanList";
            pasabahce.CLS_PAGES[] PAGES_LIST = null;
            ret     = ws.get_PAGE_ID(Global.SYSTEM_CODE, PAGE_NAME, ref PAGES_LIST, ref errMsg);
            PAGE_ID = PAGES_LIST[0].PAGE_ID;
            pasabahce.CLS_PERMISSION[] PERMISSION_LIST = null;
            ret = ws.get_PAGE_CALL(Global.SYSTEM_CODE, PAGE_ID, userInfo.USER_TYPE, ref PERMISSION_LIST, ref errMsg);

            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            if (PERMISSION_LIST[0].READ_PERMISSION == "N")
            {
                Response.Redirect("/Permission.aspx", true);
                return;
            }
            #endregion
            pasabahce.CLS_LANG_TEXT[] TEXT = null;
            ret = ws.getLangText(webConfig.SQLServerConnectionString, userInfo, userInfo.LANG, ref TEXT, ref errMsg);
            StringBuilder JS_LANG_TEXTS = new StringBuilder();
            for (int i = 0; i < TEXT.Length; i++)
            {
                JS_LANG_TEXTS.Append("LANG_TEXT['" + TEXT[i].LANG_TEXT_ID + "'] = \"" + TEXT[i].LANG_TEXT_CONTENT + "\";" + (char)13 + (char)10);
            }
            if (ret < 0)
            {
                Session["information_msg"] = errMsg;
                Response.Redirect("Information.aspx");
                return;
            }
            #region taslak files
            errMsg = "";
            var html_taslak = "";
            ret = FileUtils.getFile(webConfig.WebRootPath, "Pages/Layout/Layout.html", ref html_taslak, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            errMsg = "";
            var html_taslak_menu_bar = "";
            ret = FileUtils.getFile(webConfig.WebRootPath, "Pages/Layout/MenuBar.html", ref html_taslak_menu_bar,
                                    ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            errMsg = "";
            var html_taslak_middle_area = "";
            ret = FileUtils.getFile(webConfig.WebRootPath, "Pages/Layout/FormLayout.html", ref html_taslak_middle_area,
                                    ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            errMsg = "";
            var html_taslak_content = "";
            ret = FileUtils.getFile(webConfig.WebRootPath, "Pages/Views/ProductionWorkPlan/ProductionWorkPlanList.html",
                                    ref html_taslak_content, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            #endregion
            html_taslak = html_taslak.Replace("<!--[!USER_NAME!]-->", userInfo.USER_NAME + "&nbsp;&nbsp;&nbsp;");
            PageContentHelper.prepareMenuBar(userInfo, ref html_taslak_menu_bar);
            html_taslak             = html_taslak.Replace("<!--[!MENU_BAR!]-->", html_taslak_menu_bar);
            html_taslak             = html_taslak.Replace("<!--[!JS_LANG_TEXTS!]-->", JS_LANG_TEXTS.ToString());
            html_taslak_middle_area = html_taslak_middle_area.Replace("<!--[!PAGE_CONTENT!]-->", html_taslak_content);
            html_taslak             = html_taslak.Replace("<!--[!MIDDLE_AREA!]-->", html_taslak_middle_area);
            html_taslak             = html_taslak.Replace("<!--[!header_text!]-->", "Üretim İş Planı");
            sendHtml(userInfo, webConfig, userInfo.LANG, html_taslak);
        }
Exemplo n.º 2
0
        public void Page_Load(object sender, EventArgs e)
        {
            CacheUtils.sendNoCache(Response, Session);
            var errMsg = "";
            var ret    = 0;

            #region checkWebConfig
            var webConfig = new WebConfig();
            ret = WebConfigUtils.readWebConfig(ref webConfig, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            if (WebConfigUtils.checkWebConfig(Response, Session, ref webConfig) == false)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            #endregion
            #region checkIfLoggedIn
            errMsg = "";
            var ws        = new PASABAHCE_WEB_SERVICE();
            var USER_INFO = new CLS_USER_INFO();
            ws.init_CLS_USER_INFO(ref USER_INFO);
            ret = LoginUtils.checkIfLoggedIn(ws, webConfig, Session, Response, ref USER_INFO, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            if (USER_INFO.USER_NAME == "")
            {
                Response.Redirect("Account/LoginForm.aspx", true);
                return;
            }
            var USER_INFO_LIST = new CLS_USER_INFO();
            ret = ws.get_USER(Global.SYSTEM_CODE, USER_INFO.USER_ID, USER_INFO.SIFRE, ref USER_INFO_LIST, ref errMsg);
            int USER_TYPE = Convert.ToInt32(USER_INFO_LIST.USER_TYPE);
            Session["USER_TYPE"] = USER_TYPE;
            #endregion
            #region taslak files
            errMsg = "";
            var html_taslak = "";
            //CMS++
            pasabahce.CLS_LANG_TEXT[] TEXT = null;
            ret = ws.getLangText(webConfig.SQLServerConnectionString, USER_INFO, USER_INFO.LANG, ref TEXT, ref errMsg);
            StringBuilder JS_LANG_TEXTS = new StringBuilder();
            for (int i = 0; i < TEXT.Length; i++)
            {
                JS_LANG_TEXTS.Append("LANG_TEXT['" + TEXT[i].LANG_TEXT_ID + "'] = \"" + TEXT[i].LANG_TEXT_CONTENT + "\";" + (char)13 + (char)10);
            }
            if (ret < 0)
            {
                Session["information_msg"] = errMsg;
                Response.Redirect("Information.aspx");
                return;
            }
            //CMS--
            ret = FileUtils.getFile(webConfig.WebRootPath, "Pages/Layout/Layout.html", ref html_taslak, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            errMsg = "";
            var html_menu_bar = "";
            ret = FileUtils.getFile(webConfig.WebRootPath, "Pages/Layout/MenuBar.html", ref html_menu_bar, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            errMsg = "";
            var html_middle_area = "";
            ret = FileUtils.getFile(webConfig.WebRootPath, "Pages/Layout/FormLayout.html", ref html_middle_area, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            errMsg = "";
            var html = "";
            ret = FileUtils.getFile(webConfig.WebRootPath, "Pages/Home.html", ref html, ref errMsg);
            if (ret < 0)
            {
                MessageUtils.sendInformationMessage(Session, Response, errMsg);
                return;
            }
            #endregion
            html_taslak = html_taslak.Replace("<!--[!USER_NAME!]-->", USER_INFO.USER_NAME + "&nbsp;&nbsp;&nbsp;");
            string sayfa_baslik = "";
            if (USER_INFO.LANG == "TR")
            {
                sayfa_baslik = "Ana Sayfa";
            }
            else if (USER_INFO.LANG == "EN")
            {
                sayfa_baslik = "Home Page";
            }
            else if (USER_INFO.LANG == "BG")
            {
                sayfa_baslik = "";
            }
            PageContentHelper.prepareMenuBar(USER_INFO, ref html_menu_bar);
            //CMS
            html_taslak      = html_taslak.Replace("<!--[!JS_LANG_TEXTS!]-->", JS_LANG_TEXTS.ToString());
            html_taslak      = html_taslak.Replace("<!--[!MENU_BAR!]-->", html_menu_bar);
            html_middle_area = html_middle_area.Replace("<!--[!PAGE_CONTENT!]-->", html);
            html_taslak      = html_taslak.Replace("<!--[!MIDDLE_AREA!]-->", html_middle_area);
            html_taslak      = html_taslak.Replace("<!--[!header_text!]-->", sayfa_baslik);
            sendHtml(USER_INFO, webConfig, USER_INFO.LANG, html_taslak);
        }