Exemple #1
0
        /// <summary>
        /// Adds the office.
        /// </summary>
        /// <param name="objComOffice">The object COM office.</param>
        /// <param name="entryMode">The entry mode.</param>
        /// <param name="officeId">The office identifier.</param>
        public int AddOffice(ComOffice objComOffice, int entryMode, int officeId)
        {
            int i = 0;

            if (entryMode == 0)//to insert office item
            {
                DbCommand cmd = null;

                cmd = db.GetStoredProcCommand("pkg_office.add_office");
                db.AddInParameter(cmd, "v_office_nep_name", DbType.String, objComOffice.officeNepaliName);
                db.AddInParameter(cmd, "v_office_eng_name", DbType.String, objComOffice.officeEnglishName);

                db.AddInParameter(cmd, "v_office_parent_id", DbType.Int16, objComOffice.officeParentId);
                db.AddInParameter(cmd, "v_office_type_id", DbType.Int16, objComOffice.officeTypeId);
                /*db.AddInParameter(cmd, "v_ministry_id", DbType.Int16, objComOffice.ministryId);*/
                db.AddInParameter(cmd, "v_vdc_mun_id", DbType.Int16, objComOffice.vdcMunId);
                db.AddInParameter(cmd, "v_district_id", DbType.Int16, objComOffice.districtId);
                db.AddInParameter(cmd, "v_isEnable", DbType.Int16, objComOffice.isEnable);
                db.AddInParameter(cmd, "v_entered_by", DbType.String, null);
                db.AddInParameter(cmd, "v_entered_date", DbType.String, DateTime.Today.ToString("dd-MM-yyyy"));
                db.AddInParameter(cmd, "v_updated_by", DbType.String, null);
                db.AddInParameter(cmd, "v_updated_date", DbType.String, DateTime.Today.ToString("dd-MM-yyyy"));
                i = db.ExecuteNonQuery(cmd);
            }
            else // to update office item
            {
                DbCommand cmd = null;

                cmd = db.GetStoredProcCommand("pkg_office.update_office");
                db.AddInParameter(cmd, "v_office_nep_name", DbType.String, objComOffice.officeNepaliName);
                db.AddInParameter(cmd, "v_office_eng_name", DbType.String, objComOffice.officeEnglishName);

                db.AddInParameter(cmd, "v_office_parent_id", DbType.Int16, objComOffice.officeParentId);
                db.AddInParameter(cmd, "v_office_type_id", DbType.Int16, objComOffice.officeTypeId);
                //db.AddInParameter(cmd, "v_ministry_id", DbType.Int16, objComOffice.ministryId);
                db.AddInParameter(cmd, "v_vdc_mun_id", DbType.Int16, objComOffice.vdcMunId);
                db.AddInParameter(cmd, "v_district_id", DbType.Int16, objComOffice.districtId);
                db.AddInParameter(cmd, "v_isEnable", DbType.Int16, objComOffice.isEnable);
                db.AddInParameter(cmd, "v_entered_by", DbType.String, null);
                db.AddInParameter(cmd, "v_entered_date", DbType.String, DateTime.Today.ToString("dd-MM-yyyy"));
                db.AddInParameter(cmd, "v_updated_by", DbType.String, null);
                db.AddInParameter(cmd, "v_updated_date", DbType.String, DateTime.Today.ToString("dd-MM-yyyy"));
                db.AddInParameter(cmd, "v_office_id", DbType.Int16, officeId);
                i = db.ExecuteNonQuery(cmd);
            }
            return(i);
        }
 public int AddOffice(ComOffice objComOffice, int entryMode, int officeId)
 {
     Authentication();
     return(objOfficeDal.AddOffice(objComOffice, entryMode, officeId));
 }