Beispiel #1
0
 public static bool SaveDocumentsType(ATTDocumentsType objDocType)
 {
     try
     {
         return(DLLDocumentsType.SaveDocumentTypes(objDocType));
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
        public static List <ATTDocumentsType> GetDocumentsType(int?docTypeID)
        {
            List <ATTDocumentsType> lstDocumentsType = new List <ATTDocumentsType>();

            foreach (DataRow row in DLLDocumentsType.GetDocumentsType(docTypeID).Rows)
            {
                ATTDocumentsType obj = new ATTDocumentsType(int.Parse(row["DOC_TYPE_ID"].ToString()),
                                                            ((row["DOC_TYPE_NAME"] == System.DBNull.Value) ? "" : (string)row["DOC_TYPE_NAME"]));
                lstDocumentsType.Add(obj);
            }
            return(lstDocumentsType);
        }
Beispiel #3
0
        public static ObjectValidation Validate(ATTDocumentsType objDocType)
        {
            ObjectValidation OV = new ObjectValidation();

            if (objDocType.DocTypeName == "")
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Document Type cannot be Blank.";
                return(OV);
            }
            return(OV);
        }
Beispiel #4
0
        public static List <ATTDocumentsType> GetDocumentsType(int?docTypeID, bool DTDV)
        {
            List <ATTDocumentsType> lstDocumentsType = new List <ATTDocumentsType>();

            foreach (DataRow row in DLLDocumentsType.GetDocumentsType(docTypeID).Rows)
            {
                ATTDocumentsType obj = new ATTDocumentsType(int.Parse(row["DOC_TYPE_ID"].ToString()),
                                                            ((row["DOC_TYPE_NAME"] == System.DBNull.Value) ? "" : (string)row["DOC_TYPE_NAME"]));
                lstDocumentsType.Add(obj);
            }
            if (DTDV == true)
            {
                lstDocumentsType.Insert(0, new ATTDocumentsType(0, "--- छान्नहोस ---"));
            }
            return(lstDocumentsType);
        }
Beispiel #5
0
        public static bool SaveDocumentTypes(ATTDocumentsType objDocType)
        {
            GetConnection     GetConn = new GetConnection();
            OracleTransaction Tran    = GetConn.GetDbConn().BeginTransaction();
            int DocumentTypeID        = 0;

            try
            {
                string InsertUpdateSQL = "";

                if (objDocType.DocTypeID <= 0)
                {
                    InsertUpdateSQL = "SP_ADD_DOCUMENTS_TYPE";
                }
                else
                {
                    InsertUpdateSQL = "SP_EDIT_DOCUMENTS_TYPE";
                }

                OracleParameter[] ParamArray = new OracleParameter[2];

                ParamArray[0] = Utilities.GetOraParam(":p_DOC_TYPE_ID", objDocType.DocTypeID, OracleDbType.Int64, ParameterDirection.InputOutput);
                ParamArray[1] = Utilities.GetOraParam(":p_DOC_TYPE_NAME", objDocType.DocTypeName, OracleDbType.Varchar2, ParameterDirection.Input);

                SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, InsertUpdateSQL, ParamArray[0], ParamArray);
                DocumentTypeID       = int.Parse(ParamArray[0].Value.ToString());
                objDocType.DocTypeID = DocumentTypeID;
                Tran.Commit();
                return(true);
            }

            catch (OracleException oex)
            {
                PCS.COREDL.OracleError oe = new PCS.COREDL.OracleError();
                throw new ArgumentException(oe.GetOraError(oex.Number, oex.Message));
            }

            catch (Exception ex)
            {
                Tran.Rollback();
                throw ex;
            }
            finally
            {
                GetConn.CloseDbConn();
            }
        }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        lblStatusMessage.Text = "";
        List <ATTDocumentsType> lstDocumentsType = (List <ATTDocumentsType>)Session["DocumentsType"];
        int docTypeID = 0;

        try
        {
            if (this.DocumentsTypeList.SelectedIndex > -1)
            {
                docTypeID = lstDocumentsType[this.DocumentsTypeList.SelectedIndex].DocTypeID;
            }

            ATTDocumentsType objDocType = new ATTDocumentsType(docTypeID, this.txtDocTypeName_rqd.Text.Trim());
            ObjectValidation OV         = BLLDocumentsType.Validate(objDocType);
            if (OV.IsValid == false)
            {
                lblStatusMessage.Text = OV.ErrorMessage;
                this.programmaticModalPopup.Show();
                return;
            }

            BLLDocumentsType.SaveDocumentsType(objDocType);

            if (this.DocumentsTypeList.SelectedIndex > -1)
            {
                lstDocumentsType[this.DocumentsTypeList.SelectedIndex].DocTypeName = this.txtDocTypeName_rqd.Text.Trim();
            }
            else
            {
                objDocType = new ATTDocumentsType(objDocType.DocTypeID, this.txtDocTypeName_rqd.Text.Trim());
                lstDocumentsType.Add(objDocType);
            }

            this.DocumentsTypeList.DataSource = lstDocumentsType;
            this.lblStatusMessage.Text        = "Successfully Saved";
            this.programmaticModalPopup.Show();
            this.DocumentsTypeList.DataBind();
            this.txtDocTypeName_rqd.Text         = "";
            this.DocumentsTypeList.SelectedIndex = -1;
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
Beispiel #7
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        lblStatusMessage.Text = "";
        List <ATTDocumentsType> lstDocumentsType = (List <ATTDocumentsType>)Session["DocumentsType"];
        int docTypeID = 0;

        try
        {
            if (this.DocumentsTypeList.SelectedIndex > -1)
            {
                docTypeID = lstDocumentsType[this.DocumentsTypeList.SelectedIndex].DocTypeID;
            }

            ATTDocumentsType objDocType = new ATTDocumentsType(docTypeID, this.txtDocTypeName_rqd.Text.Trim());
            ObjectValidation OV         = BLLDocumentsType.Validate(objDocType);
            if (OV.IsValid == false)
            {
                lblStatusMessage.Text = OV.ErrorMessage;
                this.programmaticModalPopup.Show();
                return;
            }
            bool exists = lstDocumentsType.Exists(delegate(ATTDocumentsType obj)
            {
                return(obj.DocTypeName == objDocType.DocTypeName);
            }
                                                  );
            if (exists)
            {
                this.lblStatusMessage.Text = "**सोहि नामको कागजपत्रको विवरण पहिले नै उपलब्द छ";
                this.programmaticModalPopup.Show();
                this.txtDocTypeName_rqd.Text = "";
                this.txtDocTypeName_rqd.Focus();
                this.DocumentsTypeList.SelectedIndex = -1;
                return;
            }

            BLLDocumentsType.SaveDocumentsType(objDocType);

            if (this.DocumentsTypeList.SelectedIndex > -1)
            {
                lstDocumentsType[this.DocumentsTypeList.SelectedIndex].DocTypeName = this.txtDocTypeName_rqd.Text.Trim();
            }
            else
            {
                objDocType = new ATTDocumentsType(objDocType.DocTypeID, this.txtDocTypeName_rqd.Text.Trim());
                lstDocumentsType.Add(objDocType);
            }

            this.DocumentsTypeList.DataSource = lstDocumentsType;
            if (this.DocumentsTypeList.SelectedIndex == -1)
            {
                this.lblStatusMessage.Text = "Documents Type Saved Successfully. ";
                this.programmaticModalPopup.Show();
            }
            else
            {
                this.lblStatusMessage.Text = "Documents Type Updated Successfully. ";
                this.programmaticModalPopup.Show();
            }
            this.DocumentsTypeList.DataBind();
            this.txtDocTypeName_rqd.Text = "";
            this.txtDocTypeName_rqd.Focus();
            this.DocumentsTypeList.SelectedIndex = -1;
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }