//----------------------------------------------- #endregion protected void btnSave_Click(object sender, EventArgs e) { if (MoversFW.Components.UrlManager.ChechIsValidIntegerParameter("id")) { if (!Page.IsValid) { return; } int orderID = Convert.ToInt32(Request.QueryString["id"]); ItemsOrdersModel order = ItemsOrdersFactor.GetObject(orderID); order.Status = Convert.ToInt32(ddlOrderStatus.SelectedValue); order.Comment = txtComment.Text; bool status = ItemsOrdersFactor.Updat(order); if (status) { Response.Redirect("default.aspx"); } else { lblResult.CssClass = "lblResult_Faild"; lblResult.Text = Resources.AdminText.SavingDataFaild; } } else { Response.Redirect("default.aspx"); } }
//----------------------------------------------- #endregion #region ---------------LoadData--------------- //----------------------------------------------- //LoadData //----------------------------------------------- protected void LoadData() { if (MoversFW.Components.UrlManager.ChechIsValidIntegerParameter("id")) { int orderID = Convert.ToInt32(Request.QueryString["id"]); ItemsOrdersModel order = ItemsOrdersFactor.GetObject(orderID); if (orderID != null) { lblCustomerName.Text = order.CustomerName; lblCustomerEmail.Text = order.CustomerEmail; lblCustomerPhone.Text = order.CustomerPhone; lblCustomerMobile.Text = order.CustomerMobile; lblCustomerAddress.Text = order.CustomerAddress; lblDateAdded.Text = order.DateAdded.ToString(); ddlOrderStatus.SelectedValue = order.Status.ToString(); txtComment.Text = order.Comment; } else { Response.Redirect("default.aspx"); } } else { Response.Redirect("default.aspx"); } }
//-------------------------------------------------------------------------- #region --------------LoadGrid-------------- //--------------------------------------------------------- //LoadGrid //--------------------------------------------------------- private void LoadGrid() { string selectedValue = ddlUsers.SelectedValue; if (!string.IsNullOrEmpty(selectedValue)) { Guid userId = new Guid(ddlUsers.SelectedValue); pager.PageSize = 25; int totalRecords = 0; //-------------------------------------------------------------------- //Languages langID = Languages.Unknowen; //if (SiteSettings.Languages_HasMultiLanguages) // langID = (Languages)Convert.ToInt32(ddlLanguages.SelectedValue); //-------------------------------------------------------------------- List <ItemsOrdersModel> itemsList; itemsList = ItemsOrdersFactor.GetPageByPageForUser(userId, pager.CurrentPage, pager.PageSize, out totalRecords); if (itemsList != null && itemsList.Count > 0) { dgItems.DataSource = itemsList; dgItems.DataKeyField = "OrderID"; dgItems.AllowPaging = false; pager.Visible = true; pager.TotalRecords = totalRecords; dgItems.DataBind(); dgItems.Visible = true; //------------------------------------------------------------------------------- //Security Premession //-------------------------- ZecurityManager.HideGridColumn(dgItems, CommandName.Delete, dgItems.Columns.Count - 1); ZecurityManager.HideGridColumn(dgItems, CommandName.Edit, dgItems.Columns.Count - 2); /*if (currentModule.ModuleTypeID == 13) * dgItems.Columns[dgItems.Columns.Count - 1].Visible = false;*/ /*End Secu*/ //------------------------------------------------------------------------------- } else { dgItems.Visible = false; pager.Visible = false; lblResult.CssClass = "lblResult_Faild"; lblResult.Text = Resources.AdminText.ThereIsNoData; } } else { dgItems.Visible = false; pager.Visible = false; //lblResult.CssClass = "lblResult_Faild"; //lblResult.Text = Resources.AdminText.ThereIsNoData; } }
//-------------------------------------------------------- #endregion #region --------------dgItems_DeleteCommand-------------- //--------------------------------------------------------- //dgItems_DeleteCommand //--------------------------------------------------------- protected void dgItems_DeleteCommand(object source, DataGridCommandEventArgs e) { int OrderID = Convert.ToInt32(dgItems.DataKeys[e.Item.ItemIndex]); if (ItemsOrdersFactor.Delete(OrderID)) { General.MakeAlertSucess(lblResult, Resources.AdminText.DeletingOprationDone); //if one item in datagrid if (dgItems.Items.Count == 1) { --pager.CurrentPage; } LoadData(); } else { General.MakeAlertError(lblResult, Resources.AdminText.DeletingOprationFaild); } }
//----------------------------------------------- #endregion #region --------------LoadData-------------- //--------------------------------------------------------- //LoadData //--------------------------------------------------------- private void LoadData() { pager.PageSize = 25; int totalRecords = 0; //-------------------------------------------------------------------- //Languages langID = Languages.Unknowen; //if (SiteSettings.Languages_HasMultiLanguages) // langID = (Languages)Convert.ToInt32(ddlLanguages.SelectedValue); //-------------------------------------------------------------------- List <ItemsOrdersModel> itemsList; itemsList = ItemsOrdersFactor.GetPageByPage(pager.CurrentPage, pager.PageSize, out totalRecords); if (itemsList != null && itemsList.Count > 0) { dgItems.DataSource = itemsList; dgItems.DataKeyField = "OrderID"; dgItems.AllowPaging = false; pager.Visible = true; pager.TotalRecords = totalRecords; dgItems.DataBind(); dgItems.Visible = true; //------------------------------------------------------------------------------- //Security Premession //-------------------------- ZecurityManager.HideGridColumn(dgItems, CommandName.Delete, dgItems.Columns.Count - 1); ZecurityManager.HideGridColumn(dgItems, CommandName.Edit, dgItems.Columns.Count - 2); /*if (currentModule.ModuleTypeID == 13) * dgItems.Columns[dgItems.Columns.Count - 1].Visible = false;*/ /*End Secu*/ //------------------------------------------------------------------------------- } else { dgItems.Visible = false; pager.Visible = false; General.MakeAlertError(lblResult, Resources.AdminText.ThereIsNoData); } }
//-------------------------------------------------------- #endregion #region --------------dgItems_DeleteCommand-------------- //--------------------------------------------------------- //dgItems_DeleteCommand //--------------------------------------------------------- protected void dgItems_DeleteCommand(object source, DataGridCommandEventArgs e) { int OrderID = Convert.ToInt32(dgItems.DataKeys[e.Item.ItemIndex]); if (ItemsOrdersFactor.Delete(OrderID)) { lblResult.CssClass = "lblResult_Done"; lblResult.Text = Resources.AdminText.DeletingOprationDone; //if one item in datagrid if (dgItems.Items.Count == 1) { --pager.CurrentPage; } LoadData(); } else { lblResult.CssClass = "lblResult_Faild"; lblResult.Text = Resources.AdminText.DeletingOprationFaild; } }