private bool SaveData() { objCommon = new clsCommon(); if (objCommon.IsRecordExists("tblSize", tblSize.ColumnNames.AppSize, tblSize.ColumnNames.AppSizeID, txtSize.Text, hdnPKID.Value)) { DInfo.ShowMessage("Size is already exists", Enums.MessageType.Warning); return(false); } objSize = new tblSize(); if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objSize.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)); } else { objSize.AddNew(); } objSize.s_AppSize = txtSize.Text.Trim(); objSize.AppIsActive = chkIsActive.Checked; if (chkIsDefault.Checked) { tblSize ObjTemp = new tblSize(); ObjTemp.SetDefaultSize(); ObjTemp = null; objSize.AppIsActive = true; objSize.AppIsDefault = true; } else { tblSize ObjTemp = new tblSize(); ObjTemp.LoadAll(); if (ObjTemp.RowCount <= 0) { objSize.AppIsActive = true; objSize.AppIsDefault = true; } else { objSize.AppIsDefault = false; } ObjTemp = null; } objSize.Save(); iprojectID = objSize.AppSizeID; objSize = null; objClsCommon = null; return(true); }
protected void dgvGridView_RowCommand1(object sender, GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { objCommon = new clsCommon(); if (e.CommandName == "IsActive") { objSize = new tblSize(); if (objSize.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()))) { if (!objSize.AppIsDefault) { if (objSize.AppIsActive == true) { objSize.AppIsActive = false; } else if (objSize.AppIsActive == false) { objSize.AppIsActive = true; } objSize.Save(); LoadDataGrid(false, false); } } objSize = null; objCommon = null; } else if (e.CommandName == "IsDefault") { objSize = new tblSize(); objSize.SetDefaultSize(e.CommandArgument.ToString()); objSize = null; LoadDataGrid(false, false); } } }