Пример #1
0
        /// <summary>
        /// Update the Category information and positions of items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btSave_FormSubmit(object sender, EventArgs e)
        {
            int Position, NewPosition;

            try
            {
                inspect               = new clsInspections();
                inspect.cAction       = "U";
                inspect.iOrgId        = OrgId;
                inspect.iId           = InspectionId;
                inspect.iCategoryId   = CategoryId;
                inspect.sCategoryName = tbCategory.Text;
                inspect.iCatPosition  = Convert.ToInt32(ddlOrder.SelectedValue);
                if (inspect.InspectCatDetails() == -1)
                {
                    Session["lastpage"] = sCurrentPage;
                    Session["error"]    = _functions.ErrorMessage(156);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                foreach (DataGridItem Item in dgInspectItems.Items)
                {
                    Position    = Convert.ToInt32(((Label)Item.FindControl("lblCatId")).Text);
                    NewPosition = Convert.ToInt32(Request.Params["FormPosition" + Item.ItemIndex.ToString()]);
                    if (Position != NewPosition)
                    {
                        inspect.iInspectItemId = Convert.ToInt32(Item.Cells[0].Text);
                        inspect.iItemPosition  = NewPosition;
                        inspect.UpdatePosInspectItem();
                    }
                }
                Response.Redirect(sLastPage, false);
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = sCurrentPage;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (inspect != null)
                {
                    inspect.Dispose();
                }
            }
        }