public static bool DeleteBigRock(BigRock bigRock) { bool returnValue = false; List<IBaseQueryData> queryDatum = new List<IBaseQueryData>(); DeleteQueryData queryData = new DeleteQueryData(); queryData.TableName = "PLN_BigRocks"; queryData.KeyFields.Add(new FieldData { FieldName = "BigRockID", FieldType = SqlDbType.Decimal, FieldValue = bigRock.BigRockID.ToString() }); queryDatum.Add(queryData); returnValue = SQLWrapper.ExecuteQuery(queryDatum); return returnValue; }
protected void btnSave_Click(object sender, EventArgs e) { if (isValidData()) { BigRock bigRock = new BigRock(); try { if (CurrentPageMode != PageMode.Add) { bigRock = BLLBigRock.GetBigRockByID((long)Convert.ToDecimal(this.txtItemID.Text)); } bigRock.ForUser = new AppUser(); bigRock.ForUser.UserID = 1; bigRock.AsCompassRole = BLLCompassRole.GetCompassRoleByID( Convert.ToInt32(this.ddlCompassRoles.SelectedValue)); bigRock.ForWeek = Convert.ToDateTime(this.txtCurrentDate.Text); bigRock.BigRockName = this.txtBigRockName.Text; if (CurrentPageMode == PageMode.Add) { BLLBigRock.AddBigRock(bigRock); this.lblErrorText.Text = "Completed"; } else if (CurrentPageMode == PageMode.Edit) { BLLBigRock.UpdateBigRock(bigRock); this.lblErrorText.Text = "Completed"; } else { throw new Exception("Invalid Action"); } string script = "<script language='javascript' type='text/javascript'>window.returnValue = 1;;window.close();</script>"; Page.RegisterClientScriptBlock("closescript", script); } catch (Exception ex) { this.lblErrorText.Text = ex.Message; ddlCompassRoles.Focus(); } } }
public static bool AddBigRock(BigRock bigRock) { bool returnValue = false; long BigRockID = getNextBigRockID(); List<IBaseQueryData> queryDatum = new List<IBaseQueryData>(); IBaseQueryData queryData = new InsertQueryData(); queryData.TableName = "PLN_BigRocks"; queryData.Fields.Add(new FieldData { FieldName = "CompassRoleID", FieldType = SqlDbType.Int, FieldValue = bigRock.AsCompassRole.CompassRoleID.ToString() }); queryData.Fields.Add(new FieldData { FieldName = "UserId", FieldType = SqlDbType.Int, FieldValue = bigRock.ForUser.UserID.ToString() }); queryData.Fields.Add(new FieldData { FieldName = "ForWeek", FieldType = SqlDbType.Date, FieldValue = bigRock.ForWeek.ToString(Constants.DATE_FORMAT_SQL) }); queryData.Fields.Add(new FieldData { FieldName = "BigRockName", FieldType = SqlDbType.NVarChar, FieldValue = bigRock.BigRockName.Trim() }); queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = getNextSequenceID(bigRock.ForUser.UserID).ToString() }); queryDatum.Add(queryData); returnValue = SQLWrapper.ExecuteQuery(queryDatum); return returnValue; }
public static bool DeleteBigRock(long BigRockID) { BigRock BigRock = new BigRock(); BigRock.BigRockID = BigRockID; return DeleteBigRock(BigRock); }
private static BigRock loadBigRock(DataTable dtBigRocks, int RowNo) { BigRock bigRock = new BigRock(); bigRock.BigRockID = (long)Convert.ToDecimal(dtBigRocks.Rows[RowNo]["BigRockID"]); bigRock.BigRockName = dtBigRocks.Rows[RowNo]["BigRockName"].ToString(); bigRock.ForWeek = Convert.ToDateTime(dtBigRocks.Rows[RowNo]["Forweek"].ToString()); bigRock.Sequence = Convert.ToInt32(dtBigRocks.Rows[RowNo]["Sequence"]); bigRock.AsCompassRole = DALCompassRole.GetCompassRoleByID(Convert.ToInt32(dtBigRocks.Rows[RowNo]["CompassRoleID"])); bigRock.ForUser = DALAppUser.GetUserByID(Convert.ToInt32(dtBigRocks.Rows[RowNo]["UserID"])); return bigRock; }