Exemple #1
0
        public int counterdeleteDAL(int id, string Centerid)
        {
            int        val;
            RTOCounter entObj1 = new RTOCounter();

            try
            {
                using (IDbConnection db = GetConnection())
                {
                    SqlParameter[] paras = new SqlParameter[3];
                    paras[0] = new SqlParameter("@CounterID_INT", id);
                    paras[1] = new SqlParameter("@CentreCode_VCR", Centerid);
                    paras[2] = new SqlParameter("@Event", "Delete");

                    val = ExecuteSPNonQuery(db, "RTO_spCounterDetails", paras);
                }
            }

            catch (Exception ex)
            {
                throw new Exception("Unable to verify credentials" + ex);
            }


            return(val);
        }
Exemple #2
0
        public RTOCounter CounterAddDAL(string txtcountername, string txtdevicecode)
        {
            Random r           = new Random();
            string countercode = r.Next(100000, 999999).ToString();

            RTOCounter entObj1 = new RTOCounter();

            try
            {
                using (IDbConnection db = GetConnection())
                {
                    SqlParameter[] paras = new SqlParameter[4];
                    paras[0] = new SqlParameter("@CounterName_VCR", txtcountername);
                    paras[1] = new SqlParameter("@CounterCode_VCR", countercode);
                    paras[2] = new SqlParameter("@DeviceCode_VCR", txtdevicecode);
                    paras[3] = new SqlParameter("@Event", "Add");

                    using (IDataReader reader = ExecuteSPReader(db, "RTO_spCounterDetails", paras))
                    {
                        while (reader.Read())
                        {
                            entObj1.CounterName_VCR = reader[1].ToString();
                            entObj1.CounterCode_VCR = reader[2].ToString();
                            entObj1.DeviceCode_VCR  = reader[3].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to verify credentials" + ex);
            }
            return(entObj1);
        }
Exemple #3
0
        public RTOCounter CounterUpdateDAL(string txtcountername, string txtdevicecode, string dt, int idd, string centercode)
        {
            Random r           = new Random();
            string countercode = r.Next(100000, 999999).ToString();

            //string centercode = "1";

            RTOCounter entObj1 = new RTOCounter();

            try
            {
                using (IDbConnection db = GetConnection())
                {
                    SqlParameter[] paras = new SqlParameter[7];
                    paras[0] = new SqlParameter("@CounterID_INT", idd);
                    paras[1] = new SqlParameter("@CounterName_VCR", txtcountername);
                    paras[2] = new SqlParameter("@CounterCode_VCR", countercode);
                    paras[3] = new SqlParameter("@DeviceCode_VCR", txtdevicecode);
                    paras[4] = new SqlParameter("@CentreCode_VCR", centercode);
                    //paras[5] = new SqlParameter("@CounterModifyDate_DAT", dt);
                    paras[5] = new SqlParameter("@Event", "Update");

                    using (IDataReader reader = ExecuteSPReader(db, "RTO_spCounterDetails", paras))
                    {
                        while (reader.Read())
                        {
                            entObj1.CounterID_INT         = Convert.ToInt32(reader[1].ToString());
                            entObj1.CounterName_VCR       = reader[2].ToString();
                            entObj1.CounterCode_VCR       = reader[3].ToString();
                            entObj1.DeviceCode_VCR        = reader[4].ToString();
                            entObj1.CentreCode_VCR        = reader[5].ToString();
                            entObj1.CounterCreateDate_DAT = Convert.ToDateTime(reader[6].ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to verify credentials" + ex);
            }
            return(entObj1);
        }