コード例 #1
0
 protected void GridViewCurrentStoreCategory_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         switch (e.CommandName.ToLower())
         {
         case "remove":
         {
             EmployeeStoreCategory.DeleteEmployeeStoreCategoryByEmployeeStoreCategoryId(Convert.ToInt32(e.CommandArgument));
             BindEmployeeStoreCategoryList();
             BindStoreCategoryNotLinkedList();
             break;
         }
         }
     }
     catch (System.Data.SqlClient.SqlException sqlEx)
     {
         LabelError.Text = "";
         for (int i = 0; i < sqlEx.Errors.Count; i++)
         {
             LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
         }
         PanelError.Visible = true;
     }
 }
コード例 #2
0
        protected void ButtonSaveAllStores_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    LabelError.Text = "";
                    bool hasError = false;
                    EmployeeStoreCategory employeeStoreCategory = new EmployeeStoreCategory();
                    int storeType = 0; // 0 = All Store; 1 = NON TOPS; 2 = TOPS

                    if (RadioButtonStoresAll.Checked)
                    {
                        storeType = 0;
                    }
                    else if (RadioButtonStoresNonTops.Checked)
                    {
                        storeType = 1;
                    }
                    else
                    {
                        storeType = 2;
                    }

                    foreach (GridViewRow gridViewRow in GridViewResult.Rows)
                    {
                        HiddenField hiddenFieldStoreCategoryId = (HiddenField)gridViewRow.Cells[0].FindControl("HiddenFieldStoreCategoryId");
                        CheckBox    checkBoxStoreCategoryLink  = (CheckBox)gridViewRow.Cells[2].FindControl("CheckBoxStoreCategoryLink");


                        if (checkBoxStoreCategoryLink.Checked)
                        {
                            employeeStoreCategory.EmployeeId      = this.employeeId;
                            employeeStoreCategory.StoreCategoryId = Convert.ToInt32(hiddenFieldStoreCategoryId.Value);
                            employeeStoreCategory.ModifiedUser    = this.Master.LoggedOnAccount;
                            employeeStoreCategory.StoreType       = storeType;
                            employeeStoreCategory.InsertEmployeeStoreCategoryMultiple();
                        }
                    }

                    if (hasError == false)
                    {
                        Response.Redirect(String.Format("RepStoreEdit.aspx?EmployeeId={0}", this.employeeId));
                    }
                }
                catch (System.Data.SqlClient.SqlException sqlEx)
                {
                    LabelError.Text = "";
                    for (int i = 0; i < sqlEx.Errors.Count; i++)
                    {
                        LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                    }
                    PanelError.Visible = true;
                }
            }
        }
コード例 #3
0
        protected void GridViewCurrentStoreCategory_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            GridViewRow currentRow = e.Row;

            if (currentRow.RowIndex == 0)
            {
                previousGridViewCurrentStoreCategory = (Object)currentRow.DataItem;
            }

            if (currentRow.RowIndex > 0)
            {
                EmployeeStoreCategory previousEmployeeStoreCategory = (EmployeeStoreCategory)previousGridViewCurrentStoreCategory;
                EmployeeStoreCategory currentEmployeeStoreCategory  = (EmployeeStoreCategory)currentRow.DataItem;

                if (previousEmployeeStoreCategory.StoreCategoryGroup == currentEmployeeStoreCategory.StoreCategoryGroup)
                {
                    currentRow.Cells[0].ForeColor = System.Drawing.Color.White;
                }

                previousGridViewCurrentStoreCategory = (Object)currentEmployeeStoreCategory;
            }
        }
コード例 #4
0
        protected void GridViewResult_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            GridViewRow currentRow = e.Row;

            if (currentRow.RowIndex == 0)
            {
                previousGridViewResult = (Object)currentRow.DataItem;
            }

            if (currentRow.RowIndex > 0)
            {
                if (this.storeId > 0)
                {
                    StoreCategory previousStoreCategory = (StoreCategory)previousGridViewResult;
                    StoreCategory currentStoreCategory  = (StoreCategory)currentRow.DataItem;

                    if (previousStoreCategory.StoreCategoryGroup == currentStoreCategory.StoreCategoryGroup)
                    {
                        currentRow.Cells[3].ForeColor = System.Drawing.Color.White;
                        currentRow.Cells[2].Text      = String.Empty;
                    }

                    previousGridViewResult = (Object)currentStoreCategory;
                }
                else
                {
                    EmployeeStoreCategory previousStoreCategory = (EmployeeStoreCategory)previousGridViewResult;
                    EmployeeStoreCategory currentStoreCategory  = (EmployeeStoreCategory)currentRow.DataItem;

                    if (previousStoreCategory.StoreCategoryGroup == currentStoreCategory.StoreCategoryGroup)
                    {
                        currentRow.Cells[3].ForeColor = System.Drawing.Color.White;
                        currentRow.Cells[2].Text      = String.Empty;
                    }

                    previousGridViewResult = (Object)currentStoreCategory;
                }
            }
        }
コード例 #5
0
 private void BindStoreCategoryList()
 {
     GridViewResult.DataSource = EmployeeStoreCategory.GetEmployeeStoreCategoryNotLinkedAllStoresList(this.employeeId);//StoreCategory.GetStoreCategoryList();
     GridViewResult.DataBind();
 }
コード例 #6
0
 private void BindEmployeeStoreCategoryList()
 {
     GridViewCurrentStoreCategory.DataSource = EmployeeStoreCategory.GetEmployeeStoreCategoryListByEmployeeIdStoreId(this.employeeId, this.storeId);
     GridViewCurrentStoreCategory.DataBind();
 }
コード例 #7
0
        // GET api/values
        //public List<EmployeeStoreCategory> Get()
        //{
        //    return EmployeeStoreCategory.GetEmployeeStoreCategoryList();
        //}

        public string Get()
        {
            //var a = JsonConvert.SerializeObject(EmployeeStoreCategory.GetEmployeeStoreCategoryList());
            //var b = JsonConvert.DeserializeObject(a);
            return(JsonConvert.SerializeObject(EmployeeStoreCategory.GetEmployeeStoreCategoryList()));
        }