示例#1
0
        public void InsertRecord(Objects.Designation obj)
        {
            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "SP_DesignationInsert";

                cmd.Parameters.AddWithValue("@DesignationTitle", obj.DesignationTitle);

                new Database(connectionstring).ExecuteNonQueryOnly(cmd);
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtName.Text.Trim() == string.Empty)
                {
                    Message.ShowMessage(MyMessages.MessageType.MissingInfo, "Please Enter Name.");
                    txtName.Focus();
                    return;
                }


                Objects.Designation obj = new Objects.Designation();
                obj.DesignationID    = Int32.Parse(txtID.Text);
                obj.DesignationTitle = txtName.Text.Trim();


                if (!vOpenMode)
                {
                    //Insert
                    objDAL.InsertRecord(obj);
                }
                else
                {
                    // UPdate
                    objDAL.UpdateRecord(obj);
                }

                Message.ShowMessage(MyMessages.MessageType.SaveRecord);
                LoadGrid();
                btnClear_Click(sender, e);
            }
            catch (Exception exc)
            {
                Message.ShowMessage(MyMessages.MessageType.Error, exc.Message);
            }
        }