コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool returnValue = false;
            if (isValidData(true))
            {
                if (IsPageDirty)
                {
                    CompassRole compassRole = null;
                    switch (this.CurrentPageMode)
                    {
                        case PageMode.Add:
                            {
                                compassRole = new CompassRole();
                                break;
                            }
                        case PageMode.Edit:
                            {
                                compassRole = BLLCompassRole.GetCompassRoleByID(Convert.ToInt32(this.lblItemID.Text));
                                break;
                            }
                    }

                    compassRole.CompassRoleName = this.txtCompassRoleName.Text;
                    compassRole.Notes = this.txtNotes.Text;
                    compassRole.ForUser = this.CurrentUser;
                    switch (this.CurrentPageMode)
                    {
                        case PageMode.Add:
                            {
                                returnValue = BLLCompassRole.AddCompassRole(compassRole);
                                break;
                            }
                        case PageMode.Edit:
                            {
                                returnValue = BLLCompassRole.UpdateCompassRole(compassRole);
                                break;
                            }
                    }
                    compassRole = null;
                }
                this.Hide();
                this.Close();
            }
        }
コード例 #2
0
        public static bool DeleteCompassRole(CompassRole CompassRole)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            DeleteQueryData queryData = new DeleteQueryData();
            queryData.TableName = "PLN_BigRocks";
            queryData.KeyFields.Add(new FieldData { FieldName = "CompassRoleID", FieldType = SqlDbType.Int, FieldValue = CompassRole.CompassRoleID.ToString() });
            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "PLN_CompassRoles";
            queryData.KeyFields.Add(new FieldData { FieldName = "CompassRoleID", FieldType = SqlDbType.Int, FieldValue = CompassRole.CompassRoleID.ToString() });
            queryDatum.Add(queryData);

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
コード例 #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (isValidData())
            {
                try
                {
                    CompassRole compassRole = new CompassRole();
                    if (CurrentPageMode != PageMode.Add)
                    {
                        compassRole = BLLCompassRole.GetCompassRoleByID(Convert.ToInt32(this.txtItemID.Text));
                    }
                    compassRole.CompassRoleName = this.txtRoleName.Text;
                    compassRole.Notes = this.txtNotes.Text;
                    compassRole.ForUser = CurrentUser;

                    if (CurrentPageMode == PageMode.Add)
                    {
                        BLLCompassRole.AddCompassRole(compassRole);
                        this.lblErrorText.Text = "Completed";
                    }
                    else if (CurrentPageMode == PageMode.Edit)
                    {

                        BLLCompassRole.UpdateCompassRole(compassRole);
                        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;
                    this.txtRoleName.Focus();
                }
            }
        }
コード例 #4
0
        public static bool AddCompassRole(CompassRole CompassRole)
        {
            bool returnValue = false;

            int CompassRoleID = getNextCompassRoleID();

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            IBaseQueryData queryData = new InsertQueryData();
            queryData.TableName = "PLN_CompassRoles";
            queryData.Fields.Add(new FieldData { FieldName = "CompassRoleID", FieldType = SqlDbType.Int, FieldValue = CompassRoleID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "CompassRoleName", FieldType = SqlDbType.NVarChar, FieldValue = CompassRole.CompassRoleName.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "Notes", FieldType = SqlDbType.NVarChar, FieldValue = CompassRole.Notes.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "UserId", FieldType = SqlDbType.Int, FieldValue = CompassRole.ForUser.UserID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = getNextSequenceID(CompassRole.ForUser.UserID).ToString() });
            queryDatum.Add(queryData);

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
コード例 #5
0
 public static bool DeleteCompassRole(int CompassRoleID)
 {
     CompassRole CompassRole = new CompassRole();
     CompassRole.CompassRoleID = CompassRoleID;
     return DeleteCompassRole(CompassRole);
 }
コード例 #6
0
 private static CompassRole loadCompassRole(DataTable dtCompassRoles, int RowNo)
 {
     CompassRole CompassRole = new CompassRole();
     CompassRole.CompassRoleID = Convert.ToInt32(dtCompassRoles.Rows[RowNo]["CompassRoleID"]);
     CompassRole.CompassRoleName = dtCompassRoles.Rows[RowNo]["CompassRoleName"].ToString();
     CompassRole.Notes = dtCompassRoles.Rows[RowNo]["Notes"].ToString();
     CompassRole.Sequence = Convert.ToInt32(dtCompassRoles.Rows[RowNo]["Sequence"]);
     return CompassRole;
 }
コード例 #7
0
 public static bool UpdateCompassRole(CompassRole CompassRole)
 {
     return DALCompassRole.UpdateCompassRole(CompassRole);
 }
コード例 #8
0
 public static bool AddCompassRole(CompassRole CompassRole)
 {
     return DALCompassRole.AddCompassRole(CompassRole);
 }