/// <summary> /// Function to Update values in tbl_QuickLaunchItems Table /// </summary> /// <param name="infoQuickLaunchItems"></param> public void QuickLaunchItemsEdit(QuickLaunchItemsInfo infoQuickLaunchItems) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sqlcmd = new SqlCommand("QuickLaunchItemsEdit", sqlcon); sqlcmd.CommandType = CommandType.StoredProcedure; sqlcmd.Parameters.Add("@quickLaunchItemsId", SqlDbType.Decimal).Value = infoQuickLaunchItems.QuickLaunchItemsId; sqlcmd.Parameters.Add("@itemsName", SqlDbType.VarChar).Value = infoQuickLaunchItems.ItemsName; sqlcmd.Parameters.Add("@status", SqlDbType.Bit).Value = infoQuickLaunchItems.Status; sqlcmd.Parameters.Add("@extra1", SqlDbType.VarChar).Value = infoQuickLaunchItems.Extra1; sqlcmd.Parameters.Add("@extra2", SqlDbType.VarChar).Value = infoQuickLaunchItems.Extra2; sqlcmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sqlcon.Close(); } }
/// <summary> /// Save or edit function, Here checking the items in the list /// </summary> private void SaveorEdit() { try { QuickLaunchItemsInfo infoQuickLaunchItems = new QuickLaunchItemsInfo(); QuickLaunchItemsSP spQuickLaunchItems = new QuickLaunchItemsSP(); if (dtblSelected.Rows.Count >= 1) { foreach (DataRow dRoW in dtblSelected.Rows) { infoQuickLaunchItems.ItemsName = dRoW.ItemArray[0].ToString(); infoQuickLaunchItems.QuickLaunchItemsId = Convert.ToDecimal(dRoW.ItemArray[1]); infoQuickLaunchItems.Status = true; infoQuickLaunchItems.Extra1 = string.Empty; infoQuickLaunchItems.Extra2 = string.Empty; spQuickLaunchItems.QuickLaunchItemsEdit(infoQuickLaunchItems); } foreach (DataRow dRoW in dtblNonSelected.Rows) { infoQuickLaunchItems.ItemsName = dRoW.ItemArray[0].ToString(); infoQuickLaunchItems.QuickLaunchItemsId = Convert.ToDecimal(dRoW.ItemArray[1]); infoQuickLaunchItems.Status = false; infoQuickLaunchItems.Extra1 = string.Empty; infoQuickLaunchItems.Extra2 = string.Empty; spQuickLaunchItems.QuickLaunchItemsEdit(infoQuickLaunchItems); } Messages.SavedMessage(); this.Close(); } else { MessageBox.Show("Select atleast one form in quick launch", "Oneaccount", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { formMDI.infoError.ErrorString = "MC:3 " + ex.Message; } }