コード例 #1
0
        //פונקציה שרצה בעת שינוי של פרטי סניפים
        protected void btnBranchSave_Click(object sender, EventArgs e)
        {
            if (branchDdl.SelectedValue == "-1")
            {
                return;
            }
            configurationFields.branch branch = new configurationFields.branch();
            if (branchDdl.SelectedValue != "9999")
            {
                branch.BranchId = int.Parse(branchDdl.SelectedValue);
            }
            branch.CompanyId = int.Parse(companyDdl1.SelectedValue);
            branch.CityId    = int.Parse(cityForBranchDdl.SelectedValue);
            branch.Address   = txtBranchAddress.Text;
            branch.Phone     = txtBranchPhone.Text;
            int newId = systemFields.saveBranchData(branch);

            branchDdl.DataSource     = GlobFuncs.addMoreLine(GlobFuncs.getDDlWithCondition("BranchTable", "BranchId", "Address", "CompanyId", int.Parse(companyDdl1.SelectedValue)), " סניף נוסף ");
            branchDdl.DataTextField  = "name";
            branchDdl.DataValueField = "id";
            branchDdl.DataBind();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToBranchs(0,2)", true);//קריאה לפונקציית ג'אווה סקריפט מצד שרת
        }
コード例 #2
0
        //פונקציה שרצה כאשר נבחר אחד מהשדות באחד מהרשימות הנפתחות
        protected void checkSelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList drop = (DropDownList)sender;

            if (drop.ID == "companyDdl")
            {
                //בדיקה האם נבחר שדה של חברה קיימת
                string index = companyDdl.SelectedValue;
                if (index != "-1" && index != "9999")
                {
                    company company = new company();
                    company             = systemFields.getComapnyData(int.Parse(index));
                    txtApiAddress.Text  = company.apiAddress;
                    txtCompanyLogo.Text = company.logo;
                    txtCompanyName.Text = company.CompanyName;
                    txtContuctName.Text = company.contact;
                    txtRemarks.Text     = company.remarks;
                    txtSiteAddress.Text = company.siteAddress;
                }
                else if (companyDdl.SelectedValue == "9999")//במידה ונבחר הוספת חברה חדשה
                {
                    txtApiAddress.Text  = "";
                    txtCompanyLogo.Text = "";
                    txtCompanyName.Text = "";
                    txtContuctName.Text = "";
                    txtRemarks.Text     = "";
                    txtSiteAddress.Text = "";
                }
                companyBlok.Visible = true;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToCompanys()", true);
            }
            else if (drop.ID == "companyDdl1")//בדיקה האם מדובר ברשימת חברות שנפתחת כאשר רוצים לערוך סניף
            {
                branchDdl.DataSource     = GlobFuncs.addMoreLine(GlobFuncs.getDDlWithCondition("BranchTable", "BranchId", "Address", "CompanyId", int.Parse(drop.SelectedValue)), " סניף נוסף ");
                branchDdl.DataTextField  = "name";
                branchDdl.DataValueField = "id";
                branchDdl.DataBind();
                brancDdlhBlok.Visible = true;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToBranchs()", true);
            }
            else if (drop.ID == "branchDdl")//בדיקה האם מדובר ברשימה נפתחת של סניפים
            {
                branchBlok.Visible = true;
                if (branchDdl.SelectedValue != "9999" && branchDdl.SelectedValue != "-1")//בדיקה האם נבחר ערך של סניף קיים
                {
                    configurationFields.branch branch = new configurationFields.branch();
                    branch = systemFields.getBranchData(int.Parse(branchDdl.SelectedValue));
                    txtBranchAddress.Text           = branch.Address;
                    txtBranchPhone.Text             = branch.Phone;
                    cityForBranchDdl.DataSource     = GlobFuncs.GetDDL("CityTable", "CityId", "CityName");
                    cityForBranchDdl.DataTextField  = "name";
                    cityForBranchDdl.DataValueField = "id";
                    cityForBranchDdl.DataBind();
                    cityForBranchDdl.SelectedValue = branch.CityId.ToString();
                }
                else//במידה ולא נבחר ערך של סניף קיים
                {
                    cityForBranchDdl.DataSource     = GlobFuncs.GetDDL("CityTable", "CityId", "CityName");
                    cityForBranchDdl.DataTextField  = "name";
                    cityForBranchDdl.DataValueField = "id";
                    cityForBranchDdl.DataBind();
                    txtBranchAddress.Text = "";
                    txtBranchPhone.Text   = "";
                }
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToBranchs()", true);
            }
            else if (drop.ID == "ddlCity")//בדיקה האם מדובר ברשימה נפתחת של ערים
            {
                cityBlok.Visible = true;
                if (ddlCity.SelectedValue != "9999" && ddlCity.SelectedValue != "-1")
                {
                    txtCity.Text = systemFields.getCityName(int.Parse(ddlCity.SelectedValue));
                }
                else
                {
                    txtCity.Text = "";
                }
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToCity()", true);
            }
            else if (drop.ID == "carLevelDdl")//בדיקה האם מדובר ברשימה נפתחת של דרגות רכבים
            {
                carLevelBlok.Visible = true;
                if (carLevelDdl.SelectedValue != "9999" && carLevelDdl.SelectedValue != "-1")
                {
                    txtCarLevel.Text = systemFields.getCarLevelName(int.Parse(carLevelDdl.SelectedValue));
                }
                else
                {
                    txtCarLevel.Text = "";
                }
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToCarLevel()", true);
            }
        }