Beispiel #1
0
    protected void gvRowCommand(object sender, GridViewCommandEventArgs e)
    {
        string cmdName = e.CommandName.ToString();
        string cmdArg  = e.CommandArgument.ToString();

        switch (cmdName)
        {
        case "cmdEdit":
            fvTypeList.Visible  = true;
            lbAddType.Visible   = false;
            gvKindList.Visible  = !gvKindList.Visible;
            gvAssetList.Visible = !gvAssetList.Visible;

            switch (matType)
            {
            case "kind":
                DetailKindList kindDetail = new DetailKindList();
                kindDetail.KIDX        = int.Parse(cmdArg);
                dataMaster.KindList    = new DetailKindList[1];
                dataMaster.KindList[0] = kindDetail;
                dataMaster             = serviceMaster.ActionDataMaster(matType, dataMaster, 20);
                //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster.SiteList[0]));
                setFormData(fvTypeList, FormViewMode.Edit, dataMaster.KindList);
                break;

            case "asset":
                DetailAssetList assetDetail = new DetailAssetList();
                assetDetail.AsIDX       = int.Parse(cmdArg);
                dataMaster.AssetList    = new DetailAssetList[1];
                dataMaster.AssetList[0] = assetDetail;
                dataMaster = serviceMaster.ActionDataMaster(matType, dataMaster, 20);
                //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster.SiteList[0]));
                setFormData(fvTypeList, FormViewMode.Edit, dataMaster.AssetList);
                break;
            }
            break;
        }
    }
    protected void fvCommand(object sender, CommandEventArgs e)
    {
        string cmdName = e.CommandName.ToString();
        string cmdArg = e.CommandArgument.ToString();
        float dFloat = float.Parse("0");
        int dInt = 1;

        switch (cmdName)
        {
            case "cmdInsert":
                switch(matType)
                {
                    case "kind":
                        DetailKindList kindList = new DetailKindList();
                        kindList.KIDX = 0;
                        kindList.KName = ((TextBox)fvTypeList.FindControl("tbName")).Text.Trim();
                        kindList.KDesc = ((TextBox)fvTypeList.FindControl("tbDesc")).Text.Trim();

                        dataMaster.KindList = new DetailKindList[1];
                        dataMaster.KindList[0] = kindList;
                        break;
                    case "asset":
                        DetailAssetList assetList = new DetailAssetList();
                        assetList.AsIDX = 0;
                        assetList.AsName = ((TextBox)fvTypeList.FindControl("tbName")).Text.Trim();
                        assetList.AsDesc = ((TextBox)fvTypeList.FindControl("tbDesc")).Text.Trim();

                        dataMaster.AssetList = new DetailAssetList[1];
                        dataMaster.AssetList[0] = assetList;
                        break;
                }

                actionType = int.Parse("1" + "1");
                //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster));

                //execute data
                dataMaster = serviceMaster.ActionDataMaster(matType, dataMaster, actionType);
                //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster));
                //get return code
                localString = dataMaster.ReturnCode;

                //get current data
                if (localString == "0")
                {
                    funcWeb.ShowAlert(this, "ดำเนินการเรียบร้อยแล้วค่ะ");
                    //clear form
                    setFormData(fvTypeList, FormViewMode.Insert, null);
                    fvTypeList.Visible = false;
                    lbAddType.Visible = true;
                    setMaterialView(matType);
                }
                else
                {
                    funcWeb.ShowAlert(this, localString);
                }
                break;
            case "cmdUpdate":
                switch (matType)
                {
                    case "kind":
                        DetailKindList kindList = new DetailKindList();
                        kindList.KIDX = int.Parse(((Label)fvTypeList.FindControl("lblTypeIDXE")).Text);
                        kindList.KName = ((TextBox)fvTypeList.FindControl("tbName")).Text.Trim();
                        kindList.KDesc = ((TextBox)fvTypeList.FindControl("tbDesc")).Text.Trim();
                        kindList.KStatus = int.Parse(((DropDownList)fvTypeList.FindControl("ddlStatusE")).SelectedValue);

                        dataMaster.KindList = new DetailKindList[1];
                        dataMaster.KindList[0] = kindList;
                        break;
                    case "asset":
                        DetailAssetList assetList = new DetailAssetList();
                        assetList.AsIDX = int.Parse(((Label)fvTypeList.FindControl("lblTypeIDXE")).Text); ;
                        assetList.AsName = ((TextBox)fvTypeList.FindControl("tbName")).Text.Trim();
                        assetList.AsDesc = ((TextBox)fvTypeList.FindControl("tbDesc")).Text.Trim();
                        assetList.AsStatus = int.Parse(((DropDownList)fvTypeList.FindControl("ddlStatusE")).SelectedValue);

                        dataMaster.AssetList = new DetailAssetList[1];
                        dataMaster.AssetList[0] = assetList;
                        break;
                }

                actionType = int.Parse("1" + ((DropDownList)fvTypeList.FindControl("ddlStatusE")).SelectedValue);
                //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster));

                //execute data
                dataMaster = serviceMaster.ActionDataMaster(matType, dataMaster, actionType);
                //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster));
                //get return code
                localString = dataMaster.ReturnCode;

                //get current data
                if (localString == "0")
                {
                    funcWeb.ShowAlert(this, "ดำเนินการเรียบร้อยแล้วค่ะ");
                    //clear form
                    setFormData(fvTypeList, FormViewMode.Insert, null);
                    fvTypeList.Visible = false;
                    lbAddType.Visible = true;
                    setMaterialView(matType);
                }
                else
                {
                    funcWeb.ShowAlert(this, localString);
                }
                break;
            case "cmdReset":
                //clear form
                setFormData(fvTypeList, FormViewMode.Insert, null);
                fvTypeList.Visible = false;
                lbAddType.Visible = true;
                break;
            case "cmdCancel":
                //clear form
                setFormData(fvTypeList, FormViewMode.Insert, null);
                fvTypeList.Visible = false;
                lbAddType.Visible = true;
                break;
        }
    }
    protected void gvRowCommand(object sender, GridViewCommandEventArgs e)
    {
        string cmdName = e.CommandName.ToString();
        string cmdArg = e.CommandArgument.ToString();

        switch (cmdName)
        {
            case "cmdEdit":
                fvTypeList.Visible = true;
                lbAddType.Visible = false;
                gvKindList.Visible = !gvKindList.Visible;
                gvAssetList.Visible = !gvAssetList.Visible;

                switch(matType)
                {
                    case "kind":
                        DetailKindList kindDetail = new DetailKindList();
                        kindDetail.KIDX = int.Parse(cmdArg);
                        dataMaster.KindList = new DetailKindList[1];
                        dataMaster.KindList[0] = kindDetail;
                        dataMaster = serviceMaster.ActionDataMaster(matType, dataMaster, 20);
                        //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster.SiteList[0]));
                        setFormData(fvTypeList, FormViewMode.Edit, dataMaster.KindList);
                        break;
                    case "asset":
                        DetailAssetList assetDetail = new DetailAssetList();
                        assetDetail.AsIDX = int.Parse(cmdArg);
                        dataMaster.AssetList = new DetailAssetList[1];
                        dataMaster.AssetList[0] = assetDetail;
                        dataMaster = serviceMaster.ActionDataMaster(matType, dataMaster, 20);
                        //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster.SiteList[0]));
                        setFormData(fvTypeList, FormViewMode.Edit, dataMaster.AssetList);
                        break;
                }
                break;
        }
    }
Beispiel #4
0
    protected void fvCommand(object sender, CommandEventArgs e)
    {
        string cmdName = e.CommandName.ToString();
        string cmdArg  = e.CommandArgument.ToString();
        float  dFloat  = float.Parse("0");
        int    dInt    = 1;

        switch (cmdName)
        {
        case "cmdInsert":
            switch (matType)
            {
            case "kind":
                DetailKindList kindList = new DetailKindList();
                kindList.KIDX  = 0;
                kindList.KName = ((TextBox)fvTypeList.FindControl("tbName")).Text.Trim();
                kindList.KDesc = ((TextBox)fvTypeList.FindControl("tbDesc")).Text.Trim();

                dataMaster.KindList    = new DetailKindList[1];
                dataMaster.KindList[0] = kindList;
                break;

            case "asset":
                DetailAssetList assetList = new DetailAssetList();
                assetList.AsIDX  = 0;
                assetList.AsName = ((TextBox)fvTypeList.FindControl("tbName")).Text.Trim();
                assetList.AsDesc = ((TextBox)fvTypeList.FindControl("tbDesc")).Text.Trim();

                dataMaster.AssetList    = new DetailAssetList[1];
                dataMaster.AssetList[0] = assetList;
                break;
            }

            actionType = int.Parse("1" + "1");
            //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster));

            //execute data
            dataMaster = serviceMaster.ActionDataMaster(matType, dataMaster, actionType);
            //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster));
            //get return code
            localString = dataMaster.ReturnCode;

            //get current data
            if (localString == "0")
            {
                funcWeb.ShowAlert(this, "ดำเนินการเรียบร้อยแล้วค่ะ");
                //clear form
                setFormData(fvTypeList, FormViewMode.Insert, null);
                fvTypeList.Visible = false;
                lbAddType.Visible  = true;
                setMaterialView(matType);
            }
            else
            {
                funcWeb.ShowAlert(this, localString);
            }
            break;

        case "cmdUpdate":
            switch (matType)
            {
            case "kind":
                DetailKindList kindList = new DetailKindList();
                kindList.KIDX    = int.Parse(((Label)fvTypeList.FindControl("lblTypeIDXE")).Text);
                kindList.KName   = ((TextBox)fvTypeList.FindControl("tbName")).Text.Trim();
                kindList.KDesc   = ((TextBox)fvTypeList.FindControl("tbDesc")).Text.Trim();
                kindList.KStatus = int.Parse(((DropDownList)fvTypeList.FindControl("ddlStatusE")).SelectedValue);

                dataMaster.KindList    = new DetailKindList[1];
                dataMaster.KindList[0] = kindList;
                break;

            case "asset":
                DetailAssetList assetList = new DetailAssetList();
                assetList.AsIDX    = int.Parse(((Label)fvTypeList.FindControl("lblTypeIDXE")).Text);;
                assetList.AsName   = ((TextBox)fvTypeList.FindControl("tbName")).Text.Trim();
                assetList.AsDesc   = ((TextBox)fvTypeList.FindControl("tbDesc")).Text.Trim();
                assetList.AsStatus = int.Parse(((DropDownList)fvTypeList.FindControl("ddlStatusE")).SelectedValue);

                dataMaster.AssetList    = new DetailAssetList[1];
                dataMaster.AssetList[0] = assetList;
                break;
            }

            actionType = int.Parse("1" + ((DropDownList)fvTypeList.FindControl("ddlStatusE")).SelectedValue);
            //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster));

            //execute data
            dataMaster = serviceMaster.ActionDataMaster(matType, dataMaster, actionType);
            //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataMaster));
            //get return code
            localString = dataMaster.ReturnCode;

            //get current data
            if (localString == "0")
            {
                funcWeb.ShowAlert(this, "ดำเนินการเรียบร้อยแล้วค่ะ");
                //clear form
                setFormData(fvTypeList, FormViewMode.Insert, null);
                fvTypeList.Visible = false;
                lbAddType.Visible  = true;
                setMaterialView(matType);
            }
            else
            {
                funcWeb.ShowAlert(this, localString);
            }
            break;

        case "cmdReset":
            //clear form
            setFormData(fvTypeList, FormViewMode.Insert, null);
            fvTypeList.Visible = false;
            lbAddType.Visible  = true;
            break;

        case "cmdCancel":
            //clear form
            setFormData(fvTypeList, FormViewMode.Insert, null);
            fvTypeList.Visible = false;
            lbAddType.Visible  = true;
            break;
        }
    }