public EnumBase()
 {
     co_main = new BCO.MaintainEnum(ConntionDB);
 }
        }//RaiseCallbackEvent

        #endregion ICallbackEventHandler 實作成員

        private DataTable Linedata()
        {
            ////抓取本頁初次登記的時間
            //string SessionIDName = "SYS_ENUM" + PageTimeStamp.Value;

            //ParameterList.Clear();
            //SYSModel.MaintainEnum BCO = new SYSModel.MaintainEnum(ConntionDB);
            //ParameterList.Add(MODULE); //Module
            //ParameterList.Add(ENUM); //ENUM         

            ////DataTable Dt = BCO.GetByRownum(ParameterList);

            //DataTable Dt = BCO.QuerySwitch(SYSModel.MaintainEnum.QueryType.MODULE,
            //                        ParameterList
            //                        );

            ParameterList.Clear();
            SYSModel.MaintainEnum BCO = new SYSModel.MaintainEnum(ConntionDB);
            ParameterList.Add(MODULE); //Module
            ParameterList.Add(ENUM); //ENUM
            ParameterList.Add(_Code); //輸入查詢值=ENUMVALUE

            DataTable Dt = BCO.QuerySwitch(SYSModel.MaintainEnum.QueryType.Rownum,
                                      ParameterList
                                      );

            //Session[SessionIDName] = Dt;

            return Dt;
        }
示例#3
0
    /// <summary>
    /// GridView 在資料繫結資料列之後
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gv_Detail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        StringBuilder sb = new StringBuilder();


        #region 設定 GridView Button 的隱藏與顯示狀態

        if (e.Row.RowType != DataControlRowType.Pager)
        {
            e.Row.Cells[0].Visible = false;//ID
     
        }
       

        switch (e.Row.RowType)
        {
            case DataControlRowType.DataRow:

                //20101111 因為Gridview偶數列RowState會變成  Edit|Alternate 所以要改成以下寫法
                if (e.Row.RowState == DataControlRowState.Edit || e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))  
                {
                    DropDownList D1 = (DropDownList)e.Row.Cells[1].Controls[1].FindControl("D1");
                    Label SPEC_STORE = (Label)e.Row.Cells[1].Controls[1].FindControl("SPEC_STORE");

                    COM.SYS.MaintainEnum COM = new COM.SYS.MaintainEnum(ConntionDB);

                    ParameterList.Clear();
                    ParameterList.Add("STM");
                    ParameterList.Add("Type");
                    D1.DataSource = COM.QuerySwitch(SYSModel.MaintainEnum.QueryType.MODULE, ParameterList);
                    D1.DataBind();

                    if (SPEC_STORE.Text != "" )
                    {
                       D1.SelectedValue = SPEC_STORE.Text;
                    }
                    else if(SLP_TYPE.Text != null)
                    { 
                        D1.SelectedValue = SLP_TYPE.Text ;
                    }

                    Label Lable_HOLIDAY = (Label)e.Row.Cells[1].Controls[1].FindControl("Lable_HOLIDAY");
                    ((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).Text = Lable_HOLIDAY.Text;

                    //20090724 因為SLP_SLPDate 於 UpdatePanel 內無法寫入 JS 事件,所以重新繫結SLP_SLPDate JavaScript事件
                    sb.Append("<script type=\"text/javascript\">\n");
                    sb.Append("//<![CDATA[\n");
                    sb.Append(" Sys.Application.add_load(" + ((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).ClientID + "_SLPDateLoad);\n");
                    sb.Append(" function " + ((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).ClientID + "_SLPDateLoad()\n");
                    sb.Append(" {\n");
                    sb.Append("     var TextBoxCodeID = '" + ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).FindControl("TextBoxCode")).ClientID + "';\n");
                    sb.Append("     var CalFormat = '%Y/%m/%d';\n");
                    sb.Append("     var ImgID = '" + ((Image)((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).FindControl("Image1")).ClientID + "';\n");
                    sb.Append("     var RequiredVaildControl = $get('" + ((RequiredFieldValidator)((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).FindControl("RequiredFieldValidator1")).ClientID + "');\n");
                    sb.Append("     var CustomValidControl = $get('" + ((CustomValidator)((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).FindControl("CustomValidator1")).ClientID + "');\n");
                    sb.Append("     var IsRequiredHiddenControl = $get('" + ((System.Web.UI.HtmlControls.HtmlInputHidden)((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).FindControl("IsRequiredHidden")).ClientID + "');\n");
                    sb.Append("     if ($get('" + ((Image)((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).FindControl("Image1")).ClientID + "')!=null)\n");
                    sb.Append("     {\n");
                    sb.Append("         if ($get('" + ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).FindControl("TextBoxCode")).ClientID + "').readOnly)\n");
                    sb.Append("         {\n");
                    sb.Append("             $get('" + ((Image)((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).FindControl("Image1")).ClientID + "').style.display = 'none';\n");
                    sb.Append("         }\n");
                    sb.Append("         SLPCalendarCreate(TextBoxCodeID,CalFormat,ImgID,RequiredVaildControl,CustomValidControl,IsRequiredHiddenControl);\n");
                    sb.Append("     }\n");

                    sb.Append("     if ($get(TextBoxCodeID) != null)\n");
                    sb.Append("     {\n");
                    sb.Append("         $get(TextBoxCodeID).onkeydown = " + ((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).ClientID + "_Filter;//記錄keydown事件\n");
                    sb.Append("     }\n");
                    sb.Append(" }\n");


                    sb.Append(" function " + ((ASP.wui_slp_slp_slpdate_ascx)e.Row.Cells[4].Controls[3]).ClientID + "_Filter()\n");
                    sb.Append(" {\n");
                    sb.Append("     if(event.keyCode == 13) //過濾按enter不動作\n");
                    sb.Append("     {\n");
                    sb.Append("         event.returnValue = false;\n");
                    sb.Append("     }\n");
                    sb.Append(" }\n");
                    sb.Append("\n");
                    sb.Append("//]]>\n");
                    sb.Append("</script>\n");
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "SetSLPDateClinetScript", sb.ToString(), false);
                }

                break;
        }

        #endregion

    }
    public string EnumBaseName(string Code,
                               string MODULE,
                               string ENUM
                               )
    {

        string Name = "";
        string ConnectionDBStr = ((DatabaseSettings)ConfigurationManager.GetSection("dataConfiguration")).DefaultDatabase;
        MaintainEnum BCO = new MaintainEnum(ConnectionDBStr);

        if (Code != "")
        {
            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();            
            ParameterList.Add(MODULE); //Module
            ParameterList.Add(ENUM); //ENUM
            ParameterList.Add(Code); //輸入查詢值=ENUMVALUE

            DataTable Dt = BCO.QuerySwitch(MaintainEnum.QueryType.Rownum,
                                           ParameterList
                                           ); 

            if (Dt.Rows.Count > 0)
            {
                Name = Dt.Rows[0]["ENUMTYPENAME"].ToString().Trim();
            }
            else
            {
                Name = "查無資料";
            }
        }

        return Name;
    }
示例#5
0
    /// <summary>
    /// Page_Load事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            
            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";

            if (!IsPostBack)
            {
                //寫入首次載入Page TimeStamp
                PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}",
                                                    DateTime.Now.Year.ToString(),
                                                    DateTime.Now.Month.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Day.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Hour.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Minute.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Second.ToString().PadLeft(2, '0')
                                                    );


                //設定GridView預設的狀態


                Initialization_Component();

                #region 將SESSION清空

                Session["STM321_" + PageTimeStamp.Value] = null;
                #endregion

                //該頁面共有4種狀態
                //查詢 QUERY
                //檢視 VIEW
                //編輯 MODIFY
                this.hid_PageStatus.Value = "QUERY";
                this.txt_PageStatus.Text = "QUERY";

                SetPageStatus();//設定各種模式預設值


                //R
                #region
                
                COM.SYS.MaintainEnum COM = new COM.SYS.MaintainEnum(ConntionDB);
                
                ParameterList.Clear();
                ParameterList.Add("STM");
                ParameterList.Add("Type");
                
                ddl_STORE_TYPE.DataSource =  COM.QuerySwitch(SYSModel.MaintainEnum.QueryType.MODULE, ParameterList);
                ddl_STORE_TYPE.DataBind();

                this.hid_FrmStatus.Value = "fmBroswe";
                this.hid_FrmStatus.Visible = true;

                #region 清空 UploadStatusPanel 的值


                //上傳結果
                this.UploadStatusPanel1.UploadSum = 0;
                this.UploadStatusPanel1.UploadOK = 0;
                this.UploadStatusPanel1.UploadNG = 0;
                //匯入結果
                this.UploadStatusPanel1.ImportSum = 0;
                this.UploadStatusPanel1.ImportOK = 0;
                this.UploadStatusPanel1.ImportNG = 0;
                #endregion
                #endregion

                #region 預設系統功能鍵及Focus欄位

                this.Form.Attributes["onkeypress"] += "return STMCommon_WebForm_FireDefaultButton(event,'" + this.Btn_Query.ClientID + "');";

                BCO.STMCommon STMComm = new BCO.STMCommon();
                string s_ScriptManager_Script = STMComm.ToMakeUp_SetFocus_Script(STORE_YY.ClientID, false);
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "STM321", s_ScriptManager_Script, true);


                #endregion
            }
            else
            {
                if (Request.Form["__EVENTTARGET"] == "uploadFile")
                {
                    ClientFileToServerTemp();
                    
                }

            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { 
            
            Finally_Function();

        }
    }