Exemple #1
0
        public bool UpdateKo(KokoEn argEn)
        {
            bool lbRes = false;

            //if (lbRes)
            InsertKokoCharges(argEn, false);
            return(lbRes);
        }
Exemple #2
0
 /// <summary>
 /// Method to Get List of Students with Sponsers
 /// </summary>
 /// <param name="argEn">Students Entity as an Input.Sponsor,SAKO_Code,ProgramID,Faculty and CategoryCode as Input Properties.</param>
 /// <returns>Returns List of Students</returns>
 public List <KokoEn> GetKokoDetails(KokoEn argEn)
 {
     try
     {
         StudentDAL loDs = new StudentDAL();
         return(loDs.GetKokoDetails(argEn));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
        /// <summary>
        /// Method to Insert KokoCharges
        /// </summary>
        /// <param name="argEn">KokoCharges Entity is an Input.</param>
        /// <returns>Returns Boolean</returns>
        public bool InsertKokoCharges(KokoEn argEn, bool GenerateAutoNumber = true)
        {
            bool lbRes = false;
            //int iOut = 0;
            string sqlCmd;

            //string sqlCmd = "Select count(*) as cnt From SAS_KokorikulumDetails WHERE SAKO_Code = @SAKO_Code and SAKOD_CategoryCode= @SAKOD_CategoryCode and @saft";
            try
            {
                sqlCmd = "INSERT INTO SAS_KokorikulumDetails(SAKO_Code,SAKOD_CategoryCode,saft_code,SAKOD_CategoryName,sakod_feeamount,sakod_feeamountout ,sakod_gstin ,sakod_gstout ,safd_type, saft_taxmode) " +
                         " VALUES (@SAKO_Code,@SAKOD_CategoryCode,@saft_code,@SAKOD_CategoryName,@sakod_feeamountlocalin,@sakod_feeamountlocalout,@sakod_gstlocalin,@sakod_gstlocalout,@safd_type, @saft_taxmode) ";

                if (!FormHelp.IsBlank(sqlCmd))
                {
                    DbCommand cmd = _DatabaseFactory.GetDbCommand(Helper.GetDataBaseType, sqlCmd, DataBaseConnectionString);
                    _DatabaseFactory.AddInParameter(ref cmd, "@SAKO_Code", DbType.String, argEn.Code);
                    _DatabaseFactory.AddInParameter(ref cmd, "@SAKOD_CategoryCode", DbType.String, argEn.Category);
                    _DatabaseFactory.AddInParameter(ref cmd, "@saft_code", DbType.String, argEn.Saftcode);
                    _DatabaseFactory.AddInParameter(ref cmd, "@SAKOD_CategoryName", DbType.String, argEn.categoryname);
                    _DatabaseFactory.AddInParameter(ref cmd, "@sakod_feeamountlocalin", DbType.Double, argEn.FSAmount);
                    _DatabaseFactory.AddInParameter(ref cmd, "@sakod_feeamountlocalout", DbType.Double, argEn.sakodfeeamountlocalout);
                    _DatabaseFactory.AddInParameter(ref cmd, "@sakod_gstlocalin", DbType.Double, argEn.sakodgstamountlocalin);
                    _DatabaseFactory.AddInParameter(ref cmd, "@sakod_gstlocalout", DbType.Double, argEn.sakodfeegstamountlocalout);
                    _DatabaseFactory.AddInParameter(ref cmd, "@safd_type", DbType.String, argEn.FTCode);
                    _DatabaseFactory.AddInParameter(ref cmd, "@saft_taxmode", DbType.Int32, argEn.sakod_idkoko);
                    //_DatabaseFactory.AddInParameter(ref cmd, "@sakod_feeamountinterin", DbType.Double, argEn.sakodfeeamountinterin);
                    //_DatabaseFactory.AddInParameter(ref cmd, "@sakod_feeamountinterout", DbType.Double, argEn.sakodfeeamountinterout);
                    //_DatabaseFactory.AddInParameter(ref cmd, "@sakod_gstinterin", DbType.Double, argEn.sakodgstamountinterin);
                    //_DatabaseFactory.AddInParameter(ref cmd, "@sakod_gstinterout", DbType.Double, argEn.sakodgstamountinterout);
                    _DbParameterCollection = cmd.Parameters;

                    int liRowAffected = _DatabaseFactory.ExecuteNonQuery(Helper.GetDataBaseType, cmd,
                                                                         DataBaseConnectionString, sqlCmd, _DbParameterCollection);

                    if (liRowAffected > -1)
                    {
                        lbRes = true;
                    }
                    else
                    {
                        throw new Exception("Insertion Failed! No Row has been updated...");
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(lbRes);
        }
Exemple #4
0
        ///// <summary>
        ///// Method to Update FeeCharges
        ///// </summary>
        ///// <param name="argEn">FeeCharges Entity is an Input.</param>
        ///// <returns>Returns Boolean</returns>
        //public bool UpdateKokoDetails(FeeChargesEn argEn)
        //{
        //    bool flag;
        //    using (TransactionScope ts = new TransactionScope())
        //    {
        //        try
        //        {
        //            FeeChargesDAL loDs = new FeeChargesDAL();
        //            flag = loDs.UpdateKokoDetails(argEn);
        //            ts.Complete();
        //        }
        //        catch (Exception ex)
        //        {

        //            throw ex;
        //        }
        //    }
        //    return flag;
        //}
        /// <summary>
        /// Method to Update FeeCharges
        /// </summary>
        /// <param name="argEn">FeeCharges Entity is an Input.</param>
        /// <returns>Returns Boolean</returns>
        public bool UpdateKokoDetails(KokoEn argEn)
        {
            bool flag;

            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    FeeChargesDAL loDs = new FeeChargesDAL();
                    flag = loDs.UpdateKokoDetails(argEn);
                    ts.Complete();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(flag);
        }
Exemple #5
0
        /// <summary>
        /// Method to Get List of KokoCharges
        /// </summary>
        /// <param name="argEn">KokoCharges Entity is an Input.FTCode is an Input Property</param>
        /// <returns>Returns List of KokoCharges</returns>
        public List <KokoEn> Getkokobaru(FeeChargesEn argEn)
        {
            List <KokoEn> loEnList = new List <KokoEn>();
            string        sqlCmd   = "select distinct kk.sako_code , kk.sako_description, kk.sako_status," +
                                     " local.sakod_feeamount as sakodfeeamountlocalin,local.sakod_gstin as sakodgstamountlocalin, local.sakod_feeamountout as sakodfeeamountlocalout," +
                                     " local.sakod_gstout as sakodfeegstamountlocalout, nonlocal.sakod_feeamount as sakodfeeamountinterin, nonlocal.sakod_gstin as sakodgstamountinterin, " +
                                     " nonlocal.sakod_feeamountout as sakodfeeamountinterout,nonlocal.sakod_gstout as sakodgstamountinterout, local.sakod_categorycode as LocalCategory," +
                                     " nonlocal.sakod_categorycode as NonLocalCategory,local.saft_code as saft_code,local.saft_taxmode as saft_taxmode from  sas_kokorikulum kk inner join sas_feetypes ft on ft.saft_code = saft_code left join (select saft_code,sako_code,sakod_feeamount,  sakod_feeamountout, sakod_gstin, sakod_gstout, " +
                                     " safd_type,sakod_categorycode,saft_taxmode from sas_kokorikulumdetails where sas_kokorikulumdetails.sakod_categorycode in ('W')  )as local on local.sako_code = kk.sako_code and local.saft_code = ft.saft_code" +
                                     " left join (select saft_code,sako_code,sakod_feeamount,  sakod_feeamountout, sakod_gstin, sakod_gstout,safd_type, sakod_categorycode,saft_taxmode from sas_kokorikulumdetails " +
                                     " where sas_kokorikulumdetails.sakod_categorycode in ('BW')  )as nonlocal on nonlocal.sako_code = kk.sako_code and nonlocal.saft_code = ft.saft_code WHERE kk.sako_code = @SAKO_Code";

            try
            {
                if (!FormHelp.IsBlank(sqlCmd))
                {
                    DbCommand cmd = _DatabaseFactory.GetDbCommand(Helper.GetDataBaseType, sqlCmd, DataBaseConnectionString);
                    _DatabaseFactory.AddInParameter(ref cmd, "@SAKO_Code", DbType.String, argEn.FTCode);
                    _DbParameterCollection = cmd.Parameters;

                    using (IDataReader loReader = _DatabaseFactory.GetIDataReader(Helper.GetDataBaseType, cmd,
                                                                                  DataBaseConnectionString, sqlCmd, _DbParameterCollection).CreateDataReader())
                    {
                        while (loReader.Read())
                        {
                            KokoEn      loItem = new KokoEn();
                            FeeTypesDAL loDs   = new FeeTypesDAL();
                            FeeTypesEn  loEn   = new FeeTypesEn();
                            loItem.sakod_idkoko     = GetValue <int>(loReader, "saft_taxmode");
                            loItem.Code             = GetValue <string>(loReader, "sako_code");
                            loItem.Saftcode         = GetValue <string>(loReader, "saft_code");
                            loItem.LocalCategory    = GetValue <string>(loReader, "LocalCategory");
                            loItem.NonLocalCategory = GetValue <string>(loReader, "NonLocalCategory");
                            int Tax = loItem.sakod_idkoko;
                            loItem.taxmode = (GetGstMode(Tax));


                            if (loItem.taxmode == 2)
                            {
                                loItem.sakodfeeamountlocalin     = GetValue <double>(loReader, "sakodfeeamountlocalin");
                                loItem.sakodfeeamountlocalout    = GetValue <double>(loReader, "sakodfeeamountlocalout");
                                loItem.sakodgstamountlocalin     = GetValue <double>(loReader, "sakodgstamountlocalin");
                                loItem.sakodfeegstamountlocalout = GetValue <double>(loReader, "sakodfeegstamountlocalout");
                                loItem.sakodfeeamountinterin     = GetValue <double>(loReader, "sakodfeeamountinterin");
                                loItem.sakodfeeamountinterout    = GetValue <double>(loReader, "sakodfeeamountinterout");
                                loItem.sakodgstamountinterin     = GetValue <double>(loReader, "sakodgstamountinterin");
                                loItem.sakodgstamountinterout    = GetValue <double>(loReader, "sakodgstamountinterout");
                                loItem.Local_TempAmount          = loItem.sakodfeeamountlocalin - loItem.sakodgstamountlocalin;
                                loItem.LocalTempAmount           = loItem.sakodfeeamountlocalout - loItem.sakodfeegstamountlocalout;
                                loItem.Inter_TempAmount          = loItem.sakodfeeamountinterin - loItem.sakodgstamountinterin;
                                loItem.NonLocalTempAmount        = loItem.sakodfeeamountinterout - loItem.sakodgstamountinterout;
                                loItem.totalfeelocalin           = loItem.sakodfeeamountlocalin;
                                loItem.totalfeelocalout          = loItem.sakodfeeamountlocalout;
                                loItem.totalfeeinterin           = loItem.sakodfeeamountinterin;
                                loItem.totalfeeinterout          = loItem.sakodfeeamountinterout;
                            }
                            else if (loItem.taxmode == 1)
                            {
                                loItem.sakodgstamountlocalin     = GetValue <double>(loReader, "sakodgstamountlocalin");
                                loItem.sakodfeegstamountlocalout = GetValue <double>(loReader, "sakodfeegstamountlocalout");
                                loItem.sakodgstamountinterin     = GetValue <double>(loReader, "sakodgstamountinterin");
                                loItem.sakodgstamountinterout    = GetValue <double>(loReader, "sakodgstamountinterout");
                                loItem.totalfeelocalin           = GetValue <double>(loReader, "sakodfeeamountlocalin");
                                loItem.totalfeelocalout          = GetValue <double>(loReader, "sakodfeeamountlocalout");
                                loItem.totalfeeinterin           = GetValue <double>(loReader, "sakodfeeamountinterin");
                                loItem.totalfeeinterout          = GetValue <double>(loReader, "sakodfeeamountinterout");
                                loItem.sakodfeeamountlocalin     = loItem.totalfeelocalin - loItem.sakodgstamountlocalin;
                                loItem.sakodfeeamountlocalout    = loItem.totalfeelocalout - loItem.sakodfeegstamountlocalout;
                                loItem.sakodfeeamountinterin     = loItem.totalfeeinterin - loItem.sakodgstamountinterin;
                                loItem.sakodfeeamountinterout    = loItem.totalfeeinterout - loItem.sakodgstamountinterout;
                                loItem.Local_TempAmount          = loItem.totalfeelocalin - loItem.sakodgstamountlocalin;
                                loItem.LocalTempAmount           = loItem.totalfeelocalout - loItem.sakodfeegstamountlocalout;
                                loItem.Inter_TempAmount          = loItem.totalfeeinterin - loItem.sakodgstamountinterin;
                                loItem.NonLocalTempAmount        = loItem.totalfeeinterout - loItem.sakodgstamountinterout;
                            }



                            if (loItem.Saftcode != null)
                            {
                                loEnList.Add(loItem);
                            }
                        }
                        loReader.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(loEnList);
        }
Exemple #6
0
        /// <summary>
        /// Method to Update FeeCharges
        /// </summary>
        /// <param name="argEn">FeeCharges Entity is an Input.</param>
        /// <returns>Returns Boolean</returns>
        public bool UpdateKokoDetails(KokoEn argEn)
        {
            bool   lbRes = false;
            int    iOut  = 0;
            string sqlCmd;
            string sqlCmd1;

            //DeleteKoko(argEn);
            sqlCmd = "Select count(*) as cnt From SAS_KokorikulumDetails WHERE SAKO_Code = @SAKO_Code and saft_code = @saft_code";
            //sqlCmd1 = "delete From SAS_KokorikulumDetails WHERE SAKO_Code = @SAKO_Code";
            try
            {
                if (!FormHelp.IsBlank(sqlCmd))
                {
                    DbCommand cmdSel = _DatabaseFactory.GetDbCommand(Helper.GetDataBaseType, sqlCmd, DataBaseConnectionString);
                    _DatabaseFactory.AddInParameter(ref cmdSel, "@SAKO_Code", DbType.String, argEn.Code);
                    //_DatabaseFactory.AddInParameter(ref cmdSel, "@SAKOD_CategoryCode", DbType.String, argEn.Category);
                    _DatabaseFactory.AddInParameter(ref cmdSel, "@Saft_code", DbType.String, argEn.Saftcode);
                    _DbParameterCollection = cmdSel.Parameters;

                    using (IDataReader dr = _DatabaseFactory.GetIDataReader(Helper.GetDataBaseType, cmdSel,
                                                                            DataBaseConnectionString, sqlCmd, _DbParameterCollection).CreateDataReader())
                    {
                        if (dr.Read())
                        {
                            iOut = clsGeneric.NullToInteger(dr["cnt"]);
                        }
                        ///If that category code not exist then insert else update
                        if (iOut == 0)
                        {
                            lbRes = InsertKokoCharges(argEn);
                        }
                        else
                        {
                            //                            sqlCmd = @"UPDATE SAS_KokorikulumDetails
                            //                                SET SAKO_Code = @SAKO_Code, SAKOD_CategoryCode = @SAKOD_CategoryCode, SAKOD_FeeAmount = @SAKOD_FeeAmount, Saft_code = @Saft_code, sakod_feeamountout = @sakod_feeamountout, sakod_categoryname = @sakod_categoryname, sakod_gstin = @sakod_gstin, sakod_gstout = @sakod_gstout, safd_type = @safd_type
                            //                                WHERE SAKO_Code = @SAKO_Code and sakod_categorycode = @SAKOD_CategoryCode and Saft_code = @Saft_code";
                            sqlCmd = "INSERT INTO SAS_KokorikulumDetails(SAKO_Code,SAKOD_CategoryCode,saft_code,SAKOD_CategoryName,sakod_feeamount,sakod_feeamountout ,sakod_gstin ,sakod_gstout ,safd_type) " +
                                     " VALUES (@SAKO_Code,@SAKOD_CategoryCode,@saft_code,@SAKOD_CategoryName,@sakod_feeamountlocalin,@sakod_feeamountlocalout,@sakod_gstlocalin,@sakod_gstlocalout,@safd_type) ";

                            if (!FormHelp.IsBlank(sqlCmd))
                            {
                                DbCommand cmd = _DatabaseFactory.GetDbCommand(Helper.GetDataBaseType, sqlCmd, DataBaseConnectionString);
                                _DatabaseFactory.AddInParameter(ref cmd, "@SAKO_Code", DbType.String, argEn.Code);
                                _DatabaseFactory.AddInParameter(ref cmd, "@SAKOD_CategoryCode", DbType.String, argEn.Category);
                                _DatabaseFactory.AddInParameter(ref cmd, "@sakod_categoryname", DbType.String, argEn.categoryname);
                                _DatabaseFactory.AddInParameter(ref cmd, "@Saft_code", DbType.String, argEn.Saftcode);
                                _DatabaseFactory.AddInParameter(ref cmd, "@SAKOD_FeeAmount", DbType.Double, argEn.FSAmount);
                                _DatabaseFactory.AddInParameter(ref cmd, "@sakod_feeamountout", DbType.Double, argEn.sakodfeeamountlocalout);
                                _DatabaseFactory.AddInParameter(ref cmd, "@sakod_gstin", DbType.Double, argEn.sakodgstamountlocalin);
                                _DatabaseFactory.AddInParameter(ref cmd, "@sakod_gstout", DbType.Double, argEn.sakodfeegstamountlocalout);
                                _DatabaseFactory.AddInParameter(ref cmd, "@safd_type", DbType.String, argEn.FTCode);
                                _DbParameterCollection = cmd.Parameters;

                                int liRowAffected = _DatabaseFactory.ExecuteNonQuery(Helper.GetDataBaseType, cmd,
                                                                                     DataBaseConnectionString, sqlCmd, _DbParameterCollection);

                                if (liRowAffected > -1)
                                {
                                    lbRes = true;
                                }
                                else
                                {
                                    throw new Exception("Update Failed! No Row has been updated...");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lbRes);
        }