Exemplo n.º 1
0
        /// <summary>
        /// Gets the grid initialization script.
        /// </summary>
        /// <returns></returns>
        private string GetGridInitializationScript()
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("var {0} = new FilterCombo('{1}','{2}','{3}','{4}',{5},{6},'{7}','{8}');",
                                 JsObjectId,
                                 ClientID,
                                 layout.ClientID,
                                 listBox.ClientID,
                                 ToolTip,
                                 JavaScriptBuilder.ConvertToJavaScriptLine(AfterClearJScript),
                                 JavaScriptBuilder.ConvertToJavaScriptLine(ClearJSFilter),
                                 layout.ClearButtonClientID,
                                 label.ClientID);

            builder.AppendLine(JsObjectId + ".InitControl();");

            if (!string.IsNullOrEmpty(OnChangeScript))
            {
                builder.AppendLine(JsObjectId + ".OnChangeFuncName = " + OnChangeScript + ";");
                builder.AppendLine(OnChangeScript + "(" + JsObjectId + ");");
            }

            return(builder.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the HTML.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns></returns>
        public string GetHtml(System.Web.UI.Page page)
        {
            string realUrl = GetUrl(page);

            return((IncludeType == PageIncludeType.Css) ?
                   JavaScriptBuilder.GetCssInclude(realUrl) : JavaScriptBuilder.GetJsScriptInclude(realUrl));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Converts data to javaScript parameters array
        /// </summary>
        /// <returns>Add row function parametes</returns>
        public string ToJavaParamArray()
        {
            StringBuilder builder = new StringBuilder();

            bool isFirstItem = true;

            builder.Append("[");

            foreach (string value in Values)
            {
                if (isFirstItem)
                {
                    isFirstItem = false;
                }
                else
                {
                    builder.Append(", ");
                }

                builder.Append(JavaScriptBuilder.ConvertToJavaScriptLine(value));
            }
            builder.Append("]");

            return(builder.ToString());
        }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 로그인 체크  check login
        EmployeeInfo loginEmployee = new EmployeeInfo();
        VisitData    bllVisit      = new VisitData();
        TakeOutData  bllTakeOut    = new TakeOutData();

        loginEmployee = (EmployeeInfo)Session["loginMember"];
        if (loginEmployee == null)
        {
            Response.Redirect("~/login.aspx", true);
        }

        if (loginEmployee.ManagerLevel < 1)
        {
            Response.Redirect("~/login.aspx", true);
        }

        if (Request.QueryString["mode"].Equals("takeOut"))
        {
            int result = bllTakeOut.updateApprove(Request.QueryString["takeOutDataCode"], Request.QueryString["status"], "");
            Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành (처리 하였습니다).", "takeOutDataList.aspx?keyWord=" + Request.QueryString["keyWord"] + "&key=" + Request.QueryString["key"]));
        }
        else if (Request.QueryString["mode"].Equals("visit"))
        {
            int result = bllVisit.updateApprove(Request.QueryString["visitDataCode"], Request.QueryString["status"], "");
            Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành (처리 하였습니다).", "visitDataList.aspx?keyWord=" + Request.QueryString["keyWord"] + "&key=" + Request.QueryString["key"] + "&page=" + Request.QueryString["page"]));
        }
    }
Exemplo n.º 5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                var dao = DaoFactory.GetAmphoeDao();
                var dt  = dao.GetAll();

                // Here we'll add a blank row to the returned DataTable
                dt.Insert(0, EntityFactory.CreateAmphoe());

                //Creating the first row of GridView to be Editable
                GridView1.EditIndex  = 0;
                GridView1.DataSource = dt;
                GridView1.DataBind();

                //Delete string text id for row insert
                GridView1.Rows[0].Cells[1].Text = "";

                //Changing the Text for Inserting a New Record
                ((LinkButton)GridView1.Rows[0].Cells[0].Controls[0]).Text = "Insert";
            }
            catch (Exception ex)
            {
                JavaScriptBuilder.Build(new AlertBuilder(ex.Message));
            }
        }
Exemplo n.º 6
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (IsPostBack)
                {
                    return;
                }

                Load_Init();

                if (Mode.New == Mode)
                {
                    InitNewMode();
                }
                else if (Mode.Edit == Mode)
                {
                    InitEditMode();
                }
            }
            catch (Exception ex)
            {
                var message = ex.InnerException == null ? ex.Message : ex.InnerException.Message;
                JavaScriptBuilder.Build(new AlertBuilder(message));
            }
        }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 로그인 체크  check login
        EmployeeInfo loginEmployee = new EmployeeInfo();

        loginEmployee = (EmployeeInfo)Session["loginMember"];
        if (loginEmployee == null)
        {
            Response.Redirect("~/login.aspx", true);
        }

        if (loginEmployee.ManagerLevel < 1)
        {
            Response.Redirect("~/login.aspx", true);
        }
        TakeOutItemData bll = new TakeOutItemData();

        if (Request.QueryString["mode"].Equals("inTime"))
        {
            int result = bll.updateInTime(Request.QueryString["takeOutItemDataCode"], loginEmployee.Upnid);
        }
        else if (Request.QueryString["mode"].Equals("outTime"))
        {
            int result = bll.updateOutTime(Request.QueryString["takeOutDataCode"], loginEmployee.Upnid);
        }

        Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành (처리 하였습니다).", "takeOutDataList.aspx?keyWord=" + Request.QueryString["keyWord"] + "&key=" + Request.QueryString["key"]));
    }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 2019-07-15-임종우 : ESD 교육이수 정보 처리
        if (Request.QueryString["mode"].Equals("esdTime"))
        {
            Visitor     bll = new Visitor();
            VisitorInfo obj = new VisitorInfo();

            obj.VisitorCode = Convert.ToInt32(Request.QueryString["visitorCode"]);

            int result = bll.updateEdsData(obj);
        }
        else
        {
            VisitorData     bll = new VisitorData();
            VisitorDataInfo obj = new VisitorDataInfo();

            obj.VisitorDataCode = Convert.ToInt32(Request.QueryString["visitorDataCode"]);

            if (Request.QueryString["mode"].Equals("inTime"))
            {
                int result = bll.updateInTime(obj);
            }
            else if (Request.QueryString["mode"].Equals("outTime"))
            {
                int result = bll.updateOutTime(obj);
            }
        }


        String key = HttpUtility.UrlEncode(Request.QueryString["key"]);

        Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành (처리 하였습니다).", "visitDataList.aspx?keyWord=" + Request.QueryString["keyWord"] + "&key=" + key + "&page=" + Request.QueryString["page"]));
    }
Exemplo n.º 9
0
    protected void btnOutput_Click(object sender, EventArgs e)
    {
        CarVisitDataInfo carVisitDataInfo = new CarVisitDataInfo();

        carVisitDataInfo.CarDataInfo    = new CarDataInfo();
        carVisitDataInfo.CarHandlerInfo = new CarHandlerInfo();

        if (Request.Form["slHandler"].Equals("ADD"))
        {
            carHandler.CarCode = Convert.ToInt32(Request.Form["txtCarCode"]);
            carHandler.Handler = Request.Form["txthandler"];
            carHandler.Phone   = txtPhone.Text;

            bll.insertCarHandler(carHandler);
            carVisitDataInfo.CarHandlerInfo.CarHandlerCode = bll.selectMaxCarHandlerCode();
        }
        else
        {
            carVisitDataInfo.CarHandlerInfo.CarHandlerCode = Convert.ToInt32(Request.Form["txtHandlerCode"]);
        }

        carVisitDataInfo.CarDataInfo.CarCode = Convert.ToInt32(Request.Form["txtCarCode"]);
        carVisitDataInfo.EmployeeName        = txtEmployee.Text;
        carVisitDataInfo.Etc = txtEtc.Text;


        // 차량 출문 처리 (업무차)  xử lý xe ra cổng (xe công vụ )
        bll.insertCarVisitData("output", carVisitDataInfo);

        Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành 처리 하였습니다.", "carVisitDataList.aspx"));
    }
Exemplo n.º 10
0
 /// <summary>
 /// Shows the alert.
 /// </summary>
 /// <param name="message">The message.</param>
 public void ShowAlert(string message)
 {
     ScriptManager.RegisterStartupScript(Page, typeof(PageEx),
                                         message.GetHashCode().ToString(),
                                         "\n alert('" + JavaScriptBuilder.ApplyEscapeSequences(message) +
                                         "'); \n",
                                         true);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Converts html into tool tip
 /// </summary>
 /// <param name="srcHtml">Html code to convert</param>
 /// <returns>Tooltip html</returns>
 private string MakeToolTip(string srcHtml)
 {
     return(string.Format(_linkTemplate,
                          ClientID,
                          HttpUtility.HtmlEncode(JavaScriptBuilder.ConvertToJavaScriptLine(srcHtml)),
                          ToolTipWidth,
                          Delay,
                          LinkText));
 }
Exemplo n.º 12
0
        /// <summary>
        /// Setup RequireJS to be used in layouts
        /// </summary>
        /// <param name="baseUrl">Scrips folder</param>
        /// <param name="requireUrl">requirejs.js url</param>
        /// <param name="configsList">RequireJS.config files path</param>
        public static MvcHtmlString RenderRequireJsSetup(this HtmlHelper html, string baseUrl, string requireUrl,
                                                         IList <string> configsList, IRequireJsLogger logger = null)
        {
            var entryPointPath = html.RequireJsEntryPoint();

            if (entryPointPath == null)
            {
                return(new MvcHtmlString(string.Empty));
            }

            if (!configsList.Any())
            {
                throw new Exception("No config files to load.");
            }
            var processedConfigs = configsList.Select(r =>
            {
                var resultingPath = html.ViewContext.HttpContext.MapPath(r);
                PathHelpers.VerifyFileExists(resultingPath);
                return(resultingPath);
            }).ToList();

            var loader          = new ConfigLoader(processedConfigs, logger);
            var resultingConfig = loader.Get();
            var outputConfig    = new JsonConfig
            {
                BaseUrl = baseUrl,
                Locale  = html.CurrentCulture(),
                Paths   = resultingConfig.Paths.PathList.ToDictionary(r => r.Key, r => r.Value),
                Shim    = resultingConfig.Shim.ShimEntries.ToDictionary(r => r.For, r => new JsonRequireDeps
                {
                    Dependencies = r.Dependencies.Select(x => x.Dependency).ToList(),
                    Exports      = r.Exports
                }),
                Map = resultingConfig.Map.MapElements.ToDictionary(r => r.For,
                                                                   r => r.Replacements.ToDictionary(x => x.OldKey, x => x.NewKey))
            };

            var options = new JsonRequireOptions
            {
                Locale         = html.CurrentCulture(),
                PageOptions    = html.ViewBag.PageOptions,
                WebsiteOptions = html.ViewBag.GlobalOptions
            };

            var configBuilder = new JavaScriptBuilder();

            configBuilder.AddStatement(JavaScriptHelpers.SerializeAsVariable(options, "requireConfig"));
            configBuilder.AddStatement(JavaScriptHelpers.SerializeAsVariable(outputConfig, "require"));

            var requireRootBuilder = new JavaScriptBuilder();

            requireRootBuilder.AddAttributesToStatement("data-main", entryPointPath.ToString());
            requireRootBuilder.AddAttributesToStatement("src", requireUrl);

            return(new MvcHtmlString(configBuilder.Render() + requireRootBuilder.Render()));
        }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Company     bll = new Company();
        CompanyInfo obj = new CompanyInfo();

        obj         = bll.getCompany(Request["companyCode"]);
        obj.Approve = 1;
        int result = bll.updateCompany(obj);

        Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã được đồng ý (승인 처리 하였습니다).", "requestList.aspx"));
    }
Exemplo n.º 14
0
        protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            try
            {
                GridView1.EditIndex = -1;

                Search();
            }
            catch (Exception ex)
            {
                JavaScriptBuilder.Build(new AlertBuilder(ex.Message));
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Generates script for collection editor
        /// </summary>
        /// <returns>Editor initialization code</returns>
        protected override string GetGridCreationScript()
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine(base.GetGridCreationScript());

            builder.AppendFormat("{0}.newRowPromptText = {1};",
                                 JsObjName,
                                 JavaScriptBuilder.ConvertToJavaScriptLine(NewRowPromptText));
            builder.AppendFormat("{0}.newRowIdPrefix = '{1}';", JsObjName, NewRowIdPrefix);
            builder.AppendFormat("{0}.addNewRowEditor();", JsObjName);

            return(builder.ToString());
        }
Exemplo n.º 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 로그인 체크  check login
        EmployeeInfo loginEmployee = new EmployeeInfo();

        loginEmployee = (EmployeeInfo)Session["loginMember"];
        if (loginEmployee == null)
        {
            Response.Redirect("~/login.aspx", true);
        }

        if (Page.IsPostBack)
        {
            // 등록하기 Đăng ký


            // 등록 여부 검사 Có Kiểm tra đăng ký hay không
            bool exists = bll.existsComapny(regNumber1.Text, regNumber2.Text, regNumber3.Text, companyName.Text);

            if (exists == true)
            {
                Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert(companyName.Text + "là tên công ty đã được đăng ký trước (는 이미 등록된 업체 명입니다.\\nHãy tìm theo tên công ty 회사명으로 검색해 보시기 바랍니다)."));
            }
            else
            {
                // 객체를 만들어 저장 Lưu object đã tạo
                CompanyInfo company = new CompanyInfo();

                company.CompanyName  = companyName.Text;
                company.RegNumber1   = regNumber1.Text;
                company.RegNumber2   = regNumber2.Text;
                company.RegNumber3   = regNumber3.Text;
                company.Phone1       = phone1.Text;
                company.Phone2       = phone2.Text;
                company.Phone3       = phone3.Text;
                company.MasterName   = masterName.Text;
                company.Address      = address.Text;
                company.Approve      = 0;
                company.EmployeeCode = loginEmployee.Upnid;
                company.EmployeeName = loginEmployee.DisplayName;
                company.EmployeeDept = loginEmployee.Dep_name;        ///////////////////////////////////////////
                int result = bll.insertCompany(company);
                // 2011-02-11-김민우: 담당자에게 인폼 오토 메일 발송
                bll.CreateHtml(company);
                //Response.Redirect("requestList.aspx?employeeCode="+loginEmployee.Upnid);
                Response.Redirect("/COMS/main/company/requestList.aspx");
            }
        }
    }
Exemplo n.º 17
0
 protected virtual void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             Load_Init();
         }
     }
     catch (Exception ex)
     {
         var message = ex.InnerException == null ? ex.Message : ex.InnerException.Message;
         JavaScriptBuilder.Build(new AlertBuilder(message));
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// Returns list of column types
        /// </summary>
        /// <returns>Coma separated column type list</returns>
        public string GetTextList()
        {
            if (Count < 1)
            {
                return(string.Empty);
            }

            StringBuilder builder = new StringBuilder();

            for (int i = 0; i < (Count - 1); i++)
            {
                builder.Append(GetColumnText(i) + "|");
            }
            builder.Append(GetColumnText(Count - 1));

            return(JavaScriptBuilder.ConvertToJavaScriptLine(builder.ToString()));
        }
Exemplo n.º 19
0
        /// <summary>
        /// Gets the button HTML.
        /// </summary>
        /// <param name="href">The href.</param>
        /// <param name="useNewWindow">if set to <c>true</c> [use new window].</param>
        /// <param name="imageUrl">The image URL.</param>
        /// <param name="alternateText">Alternate text of image</param>
        /// <returns></returns>
        private string GetButtonHtml(string href, bool useNewWindow, string imageUrl, string alternateText)
        {
            DynamicGridButton button = new DynamicGridButton();

            button.NavigateUrl = JavaScriptBuilder.ConvertToJavaScriptLine(href);
            if (useNewWindow)
            {
                button.Target = "_blank";
            }
            if (!string.IsNullOrEmpty(imageUrl))
            {
                button.ImageUrl = ControlHelper.GetThemebleUrl(imageUrl, Page.Theme);
            }
            button.AlternateText = alternateText;

            return(button.GetHTML());
        }
Exemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        VisitorData     bll = new VisitorData();
        VisitorDataInfo obj = new VisitorDataInfo();

        if (Page.IsPostBack)
        {
            obj.VisitorDataCode = Convert.ToInt32(Request.QueryString["visitorDataCode"]);
            obj.CardNo          = cardNo.Text;

            if (Request.QueryString["mode"].Equals("inTime"))
            {
                int result = bll.updateInTime(obj);
            }
            String key = HttpUtility.UrlEncode(Request.QueryString["key"]);
            Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.selfCloseOpenerReload("Đã hoàn thành vào cổng (입문 처리 하였습니다).", "visitDataList.aspx?keyWord=" + Request.QueryString["keyWord"] + "&key=" + key + "&page=" + Request.QueryString["page"]));
        }
    }
Exemplo n.º 21
0
    private void SetPageTitle()
    {
        //TODO: Uncomment when site map
        //SiteMapNode currentNode = SiteMap.CurrentNode;
        //if (currentNode != null)
        //{
        //    Page.Header.Title = currentNode.Title;
        //}
        //else
        //{
        //    Page.Header.Title = string.Empty;
        //}
        JavaScriptBuilder loadScript = ((PageEx)Page).JavaScriptOnLoad;

        loadScript.AppendLine("\n window.parent.document.title='KB :: " +
                              JavaScriptBuilder.ApplyEscapeSequences(Page.Header.Title) + "'; \n");

        loadScript.AppendLine(SiteJavaScriptLibrary.RestorFrameScript);
    }
Exemplo n.º 22
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                var dao    = DaoFactory.GetAmphoeDao();
                var id     = GridView1.DataKeys[e.RowIndex].Value;
                var entity = dao.GetById(id, false);

                if (entity != null)
                {
                    dao.Delete(entity);
                }

                Search();
            }
            catch (Exception ex)
            {
                JavaScriptBuilder.Build(new AlertBuilder(ex.Message));
            }
        }
Exemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        TakeOutData     blltakeOutData     = new TakeOutData();
        TakeOutItemData bllTakeOutItemData = new TakeOutItemData();

        List <TakeOutItemDataInfo> list = bllTakeOutItemData.selectTakeOutItemDataList(Request.QueryString["takeOutDataCode"]);

        for (int i = 0; i < list.Count; i++)
        {
            TakeOutItemDataInfo item = (TakeOutItemDataInfo)list[i];
            int resultDel            = bllTakeOutItemData.deleteTakeOutItemData(item);
        }

        TakeOutDataInfo takeOutDataInfo = new TakeOutDataInfo();

        takeOutDataInfo.TakeOutDataCode = Request.QueryString["takeOutDataCode"];
        int result = blltakeOutData.deleteTakeOutData(takeOutDataInfo);

        Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("đã xóa (삭제 하였습니다).", "listTakeOut.aspx"));
    }
Exemplo n.º 24
0
        /// <summary>
        /// Builds object initialization script
        /// </summary>
        /// <returns>Initialization script</returns>
        private string BuildObjectInitializationScript()
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("{0}.init();\n", JsObjName);
            builder.AppendFormat("{0}.maxTextLenght = {1};", JsObjName, MaxTextLenght);
            builder.AppendFormat(
                "{0}.useActionTemplate = {1};\n",
                JsObjName,
                UseActionTemplate ? "true" : "false");
            builder.AppendFormat(
                "{0}.actionTemplate = {1};\n",
                JsObjName,
                JavaScriptBuilder.ConvertToJavaScriptLine(ActionTemplate));
            builder.AppendFormat(
                "{0}.setOnEditCellHandler({1});\n",
                JsObjName,
                EditEventHandlerName);

            return(builder.ToString());
        }
Exemplo n.º 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Car bll = new Car();
        CarVisitDataInfo obj = new CarVisitDataInfo();

        obj.CarVistDataCode = Convert.ToInt32(Request.QueryString["carVisitDataCode"]);

        int result = bll.updateOutTime(obj.CarVistDataCode);

        //if (Request.QueryString["mode"].Equals("inTime"))
        //{
        //    int result = bll.updateInTime(obj);
        //}
        //else if (Request.QueryString["mode"].Equals("outTime"))
        //{
        //    int result = bll.updateOutTime(obj);
        //}

        String key = HttpUtility.UrlEncode(Request.QueryString["key"]);

        Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành (처리 하였습니다).", "../security/carVisitDataList.aspx?keyWord=" + Request.QueryString["keyWord"] + "&key=" + key + "&page=" + Request.QueryString["page"]));
    }
Exemplo n.º 26
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                var dao = DaoFactory.GetUaeProjectManageDao();

                if (((LinkButton)GridView1.Rows[0].Cells[0].Controls[0]).Text == "Insert")
                {
                    var entity = EntityFactory.CreateUaeProjectManage();

                    entity.ProjCode  = ((TextBox)GridView1.Rows[0].Cells[3].Controls[0]).Text;
                    entity.ProjEname = ((TextBox)GridView1.Rows[0].Cells[4].Controls[0]).Text;
                    entity.ProjTname = ((TextBox)GridView1.Rows[0].Cells[5].Controls[0]).Text;

                    dao.Save(entity);
                }
                else
                {
                    var id     = GridView1.DataKeys[e.RowIndex].Value;
                    var entity = dao.GetById(id, false);

                    if (entity != null)
                    {
                        entity.ProjCode  = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
                        entity.ProjEname = ((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
                        entity.ProjTname = ((TextBox)GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text;

                        dao.Update(entity);
                    }
                }

                GridView1.EditIndex = -1;
                Search();
            }
            catch (Exception ex)
            {
                JavaScriptBuilder.Build(new AlertBuilder(ex.Message));
            }
        }
Exemplo n.º 27
0
 protected virtual void OnDeleteSucceed()
 {
     JavaScriptBuilder.Build(new AlertBuilder(Globals.Delete_succeed));
     Search();
 }
Exemplo n.º 28
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                var dao = DaoFactory.GetAmphoeDao();

                if (((LinkButton)GridView1.Rows[0].Cells[0].Controls[0]).Text == "Insert")
                {
                    var entity = EntityFactory.CreateAmphoe();

                    //entity.Id = GridView1.Rows.Count;
                    entity.ThaiName    = ((TextBox)GridView1.Rows[0].Cells[3].Controls[0]).Text;
                    entity.EnglishName = ((TextBox)GridView1.Rows[0].Cells[4].Controls[0]).Text;

                    var user = ComponentFactory.CreateUserAccount();
                    user.UserId = "0402";

                    SessionAdapter.User = user;

                    #region Create by
                    entity.CreateBy = SessionAdapter.User;

                    var createDatetime = ComponentFactory.CreateDateTime();
                    createDatetime.Value = DateTime.Now;

                    entity.CreateDate = createDatetime;
                    #endregion

                    dao.Save(entity);
                }
                else
                {
                    var id     = GridView1.DataKeys[e.RowIndex].Value;
                    var entity = dao.GetById(id, false);

                    if (entity != null)
                    {
                        entity.ThaiName    = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
                        entity.EnglishName = ((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;

                        var user = ComponentFactory.CreateUserAccount();
                        user.UserId = "0402";

                        SessionAdapter.User = user;

                        #region Update by
                        entity.UpdateBy = SessionAdapter.User;

                        var updateDatetime = ComponentFactory.CreateDateTime();
                        updateDatetime.Value = DateTime.Now;

                        entity.UpdateDate = updateDatetime;
                        #endregion

                        dao.Update(entity);
                    }
                }

                GridView1.EditIndex = -1;
                Search();
            }
            catch (Exception ex)
            {
                JavaScriptBuilder.Build(new AlertBuilder(ex.Message));
            }
        }
Exemplo n.º 29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 관리자 체크  check người quản lý
        EmployeeInfo loginEmployee = new EmployeeInfo();

        loginEmployee = (EmployeeInfo)Session["loginMember"];
        if (loginEmployee == null)
        {
            Response.Redirect("~/login.aspx", true);
        }

        if (loginEmployee.ISAdmin == false)
        {
            Response.Redirect("~/login.aspx", true);
        }

        if (Page.IsPostBack)
        {
            // 수정하기  sửa
            if (mode.Value.Equals("modify"))
            {
                CompanyInfo company = new CompanyInfo();

                company = bll.getCompany(Request["companyCode"]);

                company.CompanyCode         = Convert.ToInt32(Request.QueryString["companyCode"]);
                company.CompanyName         = companyName.Text;
                company.RegNumber1          = regNumber1.Text;
                company.RegNumber2          = regNumber2.Text;
                company.RegNumber3          = regNumber3.Text;
                company.Phone1              = phone1.Text;
                company.Phone2              = phone2.Text;
                company.Phone3              = phone3.Text;
                company.MasterName          = masterName.Text;
                company.Address             = address.Text;
                company.CompanyManagementNo = companyManagementNo.Text;
                company.CompanyStartNo      = companyStartNo.Text;

                int result = bll.updateCompany(company);
                Response.Redirect("companyList.aspx");
            }
            // 등록하기 quay lại
            else
            {
                // 등록 여부 검사   kiểm tra có đăng ký hay không
                bool exists = bll.existsComapny(regNumber1.Text, regNumber2.Text, regNumber3.Text, companyName.Text);

                if (exists == true)
                {
                    Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert(companyName.Text + "là tên công ty đã được đăng ký. \\nHãy tìm theo tên công ty. (는 이미 등록된 업체 명입니다.\\n회사명으로 검색해 보시기 바랍니다)."));
                }
                else
                {
                    // 객체를 만들어 저장  lưu object được tạo
                    CompanyInfo company = new CompanyInfo();

                    company.CompanyName         = companyName.Text;
                    company.RegNumber1          = regNumber1.Text;
                    company.RegNumber2          = regNumber2.Text;
                    company.RegNumber3          = regNumber3.Text;
                    company.Phone1              = phone1.Text;
                    company.Phone2              = phone2.Text;
                    company.Phone3              = phone3.Text;
                    company.MasterName          = masterName.Text;
                    company.Address             = address.Text;
                    company.Approve             = 1;
                    company.EmployeeCode        = loginEmployee.Upnid;
                    company.CompanyManagementNo = companyManagementNo.Text;
                    company.CompanyStartNo      = companyStartNo.Text;
                    company.EmployeeName        = loginEmployee.DisplayName;
                    company.EmployeeDept        = loginEmployee.Dep_name;

                    int result = bll.insertCompany(company);
                    bll.CreateHtml(company);
                    Response.Redirect("companyList.aspx");
                }
            }
        }
        else
        {
            if (Request.QueryString["mode"].Equals("modify"))
            {
                CompanyInfo company = bll.getCompany(Request.QueryString["companyCode"]);

                companyName.Text         = company.CompanyName;
                regNumber1.Text          = company.RegNumber1;
                regNumber2.Text          = company.RegNumber2;
                regNumber3.Text          = company.RegNumber3;
                phone1.Text              = company.Phone1;
                phone2.Text              = company.Phone2;
                phone3.Text              = company.Phone3;
                masterName.Text          = company.MasterName;
                address.Text             = company.Address;
                companyManagementNo.Text = company.CompanyManagementNo;
                companyStartNo.Text      = company.CompanyStartNo;

                lableCodeName.Text = "Sửa thông tin công ty (업체 정보 수정하기) : " + company.CompanyName;
                mode.Value         = Request.QueryString["mode"];
            }
            else
            {
                lableCodeName.Text = "Đăng ký công ty (업체 등록하기)";
                mode.Value         = Request.QueryString["mode"];
            }
        }
    }
Exemplo n.º 30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Car bll = new Car();

        #region control Add Attribute

        number.Attributes.Add("onblur", "numCheck();");
        //txtCarNo.Attributes.Add("onkeypress", "numCheck();");

        // 2019-03-26-임종우 : .net 에서 client단에 readonly 설정 시 값을 안 가져오는 문제 발생.. 서버에 Attributes 추가로 해결 함.
        companyName.Attributes.Add("readonly", "readonly");

        #endregion

        if (Page.IsPostBack)
        {
            // 객체 생성 Hình thành Object
            CarDataInfo    carData    = new CarDataInfo();
            CarHandlerInfo carHandler = new CarHandlerInfo();

            carData.CarCategoryCode = Convert.ToInt32(carCategoryCode.SelectedValue);
            carData.Header          = header.Text;
            carData.Number          = number.Text;
            //carData.Handler = handler.Text;
            carData.Reject        = 0;
            carData.RejectContent = "";
            carData.CarType       = "4";
            carData.CompanyName   = companyName.Text;

            if (!String.IsNullOrEmpty(companyCode.Value))
            {
                carData.CompanyCode = Convert.ToInt32(companyCode.Value);
            }

            // 차량번호 중복 검사 로직 삭제 (2008.03.10)
            //if (bll.existsCarData(carData.Header, carData.Number,carData.Handler))
            //{
            //    Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert(header.Text + number.Text + " 는 이미 등록된 차량 번호 입니다."));
            //}
            //else
            //{
            //    int result = bll.insertCarData(carData);
            //    Response.Redirect("searchCar.aspx");
            //}

            if (bll.existsCarData(carData.Header, carData.Number))
            {
                Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert(number.Text + " là số xe đã được đăng ký trước (는 이미 등록된 차량 번호 입니다)."));
            }
            else if (String.IsNullOrEmpty(carData.CompanyName))
            {
                Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert("Nhập tên công ty (회사명을 입력하여 주세요)."));
            }
            else
            {
                int result  = bll.insertCarData(carData);
                int carCode = bll.selectMaxCarCode();

                carHandler.CarCode = carCode;
                carHandler.Handler = handler.Text;
                carHandler.Phone   = "";

                //운전자 등록 đăng ký lái xe
                bll.insertCarHandler(carHandler);

                Response.Redirect("searchCar.aspx");
            }

            //int result = bll.insertCarData(carData);
            //Response.Redirect("searchCar.aspx");
        }
        else
        {
            lableCodeName.Text = "Đăng ký xe (차량 등록하기)";
            mode.Value         = Request.QueryString["mode"];
        }
    }