Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DocumentTypes objDocumentTypes = new DocumentTypes();
            objDocumentTypes.DocumentTypeDesc = txtDocumentTypeDesc.Text;
            objDocumentTypes.Status = 1;


            if (!string.IsNullOrEmpty(hfDocumentTypeID.Value.ToString()))
            {
                objDocumentTypes.UpdatedBy = UserAuthentication.GetUserId(this.Page);
                objDocumentTypes.UpdatedDate = DateTime.Now;
                objDocumentTypes.DocumentTypeID = Convert.ToInt32(hfDocumentTypeID.Value);
                objDocumentTypes.DocumentTypeDesc = txtDocumentTypeDesc.Text;
                DocumentTypesBO.UpdateDocumentTypes(objDocumentTypes);

            }
            else
            {
                objDocumentTypes.CreatedBy = UserAuthentication.GetUserId(this.Page);
                objDocumentTypes.CreatedDate = DateTime.Now;
                DocumentTypesBO.InsertDocumentTypes(objDocumentTypes);
            }

            txtDocumentTypeDesc.Text = string.Empty;
            hfDocumentTypeID.Value = string.Empty;
            loadDocumentType();

        }
        public int DeleteDocumentTypes(DocumentTypes objDocumentTypes)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "Status" };
                rowsaffected = Update(objDocumentTypes, UpdateProperties);

                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;
        }
        public int InsertDocumentTypes(DocumentTypes objDocumentTypes)
        {
            objDocumentTypes.DocumentTypeID = 1;
            BeginTransaction();

            try
            {
                objDocumentTypes.DocumentTypeID = Insert(objDocumentTypes);
                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objDocumentTypes.DocumentTypeID = -1;
            }

            return objDocumentTypes.DocumentTypeID;
        }
Example #4
0
        protected void gvDocumentType_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            hfDocumentTypeID.Value = e.CommandArgument.ToString();
            DocumentTypes objDocumentTypes = new DocumentTypes();

            if (e.CommandName.Equals("cmdEdit"))
            {
                objDocumentTypes = DocumentTypesBO.GetDocumentTypes(Convert.ToInt32(e.CommandArgument));
                txtDocumentTypeDesc.Text = objDocumentTypes.DocumentTypeDesc;
            }
            else if (e.CommandName.Equals("cmdDelete"))
            {
                int DocumentTypeID = Convert.ToInt32(e.CommandArgument);
                objDocumentTypes.DocumentTypeID = DocumentTypeID;
                objDocumentTypes.Status = 0;
                DocumentTypesBO.DeleteDocumentTypes(objDocumentTypes);
                loadDocumentType();
            }
        }
 public static int DeleteDocumentTypes(DocumentTypes objDocumentTypes)
 {
     return new DocumentTypesDAO().DeleteDocumentTypes(objDocumentTypes);
 }
 public static int UpdateDocumentTypes(DocumentTypes objDocumentTypes)
 {
     return new DocumentTypesDAO().UpdateDocumentTypes(objDocumentTypes);
 }
 public static DocumentTypes GetDocumentTypes(int DocumentTypeID)
 {
     DocumentTypes objDocumentTypes = new DocumentTypes();
     return (DocumentTypes)(new DocumentTypesDAO().FillDTO(objDocumentTypes, "DocumentTypeID=" + DocumentTypeID));
 }
 public static int InsertDocumentTypes(DocumentTypes objDocumentTypes)
 {
     return new DocumentTypesDAO().InsertDocumentTypes(objDocumentTypes);
 }