예제 #1
0
    protected void Row_Select(object sender, DirectEventArgs e)
    {
        X.AddScript("removeLine('txtCode');");
        var list = JSON.Deserialize <LocationList>(e.ExtraParams["rowdata"]);

        hidRowID.Text = list.RowID;
        Code.Text     = list.Code;

        Name.Text     = list.Name;
        Country.Text  = list.Country;
        City.Text     = list.City;
        Currency.Text = list.Currency;
        AirAgent.setValue(list.AIR);
        OceanAgent.setValue(list.OCEAN);
        chkActive.Checked = list.Active == "1" ? true : false;
        string[] statlist = string.IsNullOrEmpty(list.StatList) ? new string[] { } : list.StatList.Split(',');
        CheckGroupClear();

        foreach (string str in statlist)
        {
            for (int i = 0; i < tblChkGroup.Items.Count(); ++i)
            {
                if (tblChkGroup.Items[i].Tag.ToString().Trim().ToUpper() == str.Trim().ToUpper())
                {
                    tblChkGroup.Items[i].Checked = true;
                    break;
                }
            }
        }
        Code.Disabled   = true;
        div_bottom.Html = "<p class=''>Status : Edit the record  of <span>" + Code.Text + "</span> . </p>";
        Name.Focus(false, Name.Text.Length);
    }
예제 #2
0
    protected void btnSave_Click(object sender, DirectEventArgs e)
    {
        string strStat = "";

        for (int i = 0; i < tblChkGroup.Items.Count(); ++i)
        {
            if (!tblChkGroup.Items[i].Checked)
            {
                strStat += tblChkGroup.Items[i].Tag.Trim() + ",";
            }
        }

        strStat = strStat.Length > 0 ? strStat.Substring(0, strStat.Length - 1) : strStat;

        if (string.IsNullOrEmpty(Code.Text))
        {
            Code.Focus(true);
            div_bottom.Html = "<p class='error'>Status : The code can't be empty .</p>";
            return;
        }
        if (string.IsNullOrEmpty(Name.Text))
        {
            Name.Focus(true);
            div_bottom.Html = "<p class='error'>Status : The description can't be empty .</p>";
            return;
        }

        if (string.IsNullOrEmpty(Country.Text))
        {
            Country.Focus(true);
            div_bottom.Html = "<p class='error'>Status : The country can't be empty .</p>";
            return;
        }

        if (Code.Text.Trim().Length < 3)
        {
            Code.Focus(true);
            div_bottom.Html = "<p class=\"error\">Status : The Code length can not be less than 3 . </p>";
            return;
        }

        if (BaseCheckCode.Check("location", Code.Text.ToUpper().Trim(), sys, hidRowID.Text) == "N")
        {
            Code.Focus(true);
            div_bottom.Html = "<p class=\"error\">Status : Saved failed ,the code already exists! </p>";
            return;
        }

        bool bFlag = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_BasicData_Location_SP", new List <IFields>()
        {
            dal.CreateIFields().Append("Option", "Update")
            .Append("User", FSecurityHelper.CurrentUserDataGET()[0])
            .Append("SYS", sys)
            .Append("STAT", FSecurityHelper.CurrentUserDataGET()[12])
            .Append("Code", Code.Text.ToUpper().Trim())
            .Append("Name", Name.Text.Trim().ToUpper())
            .Append("Country", Country.Value)
            .Append("City", City.Text.ToUpper().Trim())
            .Append("Currency", Currency.Value)
            .Append("AirAgent", AirAgent.Value)
            .Append("OceanAgent", OceanAgent.Value)
            .Append("Active", chkActive.Checked?"1":"0")
            .Append("ROWID", hidRowID.Text)
            .Append("statstr", strStat)
            .Append("dept", FSecurityHelper.CurrentUserDataGET()[28].ToUpper())
        }).Update();

        if (bFlag)
        {
            if (!string.IsNullOrEmpty(Request["control"]))
            {
                X.AddScript("window.parent.ChildCallBack(Request(\"control\"), $(\"#Code\").val());");
                return;
            }

            if (i == 1)
            {
                Code.Text     = "";
                Name.Text     = "";
                Country.Text  = "";
                City.Text     = "";
                Currency.Text = "";
                AirAgent.setValue("");
                OceanAgent.setValue("");
                hidRowID.Text     = "0";
                chkActive.Checked = true;
                Code.Disabled     = false;
                Code.Focus(true);
                CheckGroupChecked();
            }
            else
            {
                Code.Disabled = true;
                hidRowID.Text = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_BasicData_Location_SP", new List <IFields>()
                {
                    dal.CreateIFields().Append("Option", "List")
                    .Append("SYS", sys)
                    .Append("code", Code.Text)
                    .Append("STAT", FSecurityHelper.CurrentUserDataGET()[12])
                    .Append("dept", FSecurityHelper.CurrentUserDataGET()[28])
                    .Append("num", 1)
                }).GetTable().Rows[0][0].ToString();
            }
            div_bottom.Html = "<p class='success'>Status: Saved successful . </p>";
            //next = true;
            this.BindData();
        }
        else
        {
            // X.Msg.Alert("Status", "saved failed", "Code.focus();").Show();
            div_bottom.Html = "<p class='error'>Status: Saved failed , please check the data ! </p>";
            Code.Focus();
            //next = false;
        }
    }