protected void btnSave_Click(object sender, EventArgs e) { DeliveryOrderStatus status = new DeliveryOrderStatus(); if (EditDeliveryOrderStatus > 0) { status.LoadByPrimaryKey(EditDeliveryOrderStatus); } else { status.AddNew(); } status.DeliveryOrderStatusName = txtStatusName.Text; status.DeliveryOrderStatusNameAr = txtStatusNameAr.Text; status.StatusClass = dropDownStatusColor.Value; status.Save(); ClearFields(); bindData(); panelStatusGrid.Visible = true; panelStatusEdit.Visible = false; }
protected void GridViewStatus_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "editStatus") { DeliveryOrderStatus status = new DeliveryOrderStatus(); status.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString())); txtStatusName.Text = status.DeliveryOrderStatusName; txtStatusNameAr.Text = status.DeliveryOrderStatusNameAr; dropDownStatusColor.Value = status.StatusClass; EditDeliveryOrderStatus = int.Parse(e.CommandArgument.ToString()); panelStatusGrid.Visible = false; panelStatusEdit.Visible = true; } else if (e.CommandName == "deleteStatus") { DeliveryOrderStatus status = new DeliveryOrderStatus(); status.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString())); status.MarkAsDeleted(); status.Save(); bindData(); } }