Esempio n. 1
0
        public bool DeleteMAccYear(MAccYear maccyear)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "DeleteMAccYear";

            cmd.Parameters.AddWithValue("@AccYearNo", maccyear.AccYearNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                maccyear.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Esempio n. 2
0
        public bool AddMAccYear(MAccYear maccyear)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddMAccYear";

            cmd.Parameters.AddWithValue("@AccYearNo", maccyear.AccYearNo);

            cmd.Parameters.AddWithValue("@AccYearName", maccyear.AccYearName);

            cmd.Parameters.AddWithValue("@FinancialYear", maccyear.FinancialYear);

            cmd.Parameters.AddWithValue("@BooksBeginFrom", maccyear.BooksBeginFrom);

            cmd.Parameters.AddWithValue("@BooksEndOn", maccyear.BooksEndOn);

            cmd.Parameters.AddWithValue("@AssesmentYearName", maccyear.AssesmentYearName);

            cmd.Parameters.AddWithValue("@DatabaseName", maccyear.DatabaseName);

            cmd.Parameters.AddWithValue("@IsLocked", maccyear.IsLocked);

            cmd.Parameters.AddWithValue("@IsActive", maccyear.IsActive);

            cmd.Parameters.AddWithValue("@UserID", maccyear.UserID);

            cmd.Parameters.AddWithValue("@UserDate", maccyear.UserDate);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                maccyear.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Esempio n. 3
0
        public MAccYear ModifyMAccYearByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MAccYear where AccYearNo =" + ID;
            cmd            = new SqlCommand(sql, Con);
            cmd.Connection = Con;
            Con.Open();
            cmd.CommandType = CommandType.Text;
            SqlDataReader dr;

            dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (dr.HasRows)
            {
                MAccYear MM = new MAccYear();
                while (dr.Read())
                {
                    MM.AccYearNo = Convert.ToInt32(dr["AccYearNo"]);
                    if (!Convert.IsDBNull(dr["AccYearName"]))
                    {
                        MM.AccYearName = Convert.ToString(dr["AccYearName"]);
                    }
                    if (!Convert.IsDBNull(dr["FinancialYear"]))
                    {
                        MM.FinancialYear = Convert.ToString(dr["FinancialYear"]);
                    }
                    if (!Convert.IsDBNull(dr["BooksBeginFrom"]))
                    {
                        MM.BooksBeginFrom = Convert.ToDateTime(dr["BooksBeginFrom"]);
                    }
                    if (!Convert.IsDBNull(dr["BooksEndOn"]))
                    {
                        MM.BooksEndOn = Convert.ToDateTime(dr["BooksEndOn"]);
                    }
                    if (!Convert.IsDBNull(dr["AssesmentYearName"]))
                    {
                        MM.AssesmentYearName = Convert.ToString(dr["AssesmentYearName"]);
                    }
                    if (!Convert.IsDBNull(dr["DatabaseName"]))
                    {
                        MM.DatabaseName = Convert.ToString(dr["DatabaseName"]);
                    }
                    if (!Convert.IsDBNull(dr["IsLocked"]))
                    {
                        MM.IsLocked = Convert.ToBoolean(dr["IsLocked"]);
                    }
                    if (!Convert.IsDBNull(dr["IsActive"]))
                    {
                        MM.IsActive = Convert.ToBoolean(dr["IsActive"]);
                    }
                    if (!Convert.IsDBNull(dr["UserID"]))
                    {
                        MM.UserID = Convert.ToInt64(dr["UserID"]);
                    }
                    if (!Convert.IsDBNull(dr["UserDate"]))
                    {
                        MM.UserDate = Convert.ToDateTime(dr["UserDate"]);
                    }
                    if (!Convert.IsDBNull(dr["ModifiedBy"]))
                    {
                        MM.ModifiedBy = Convert.ToString(dr["ModifiedBy"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MAccYear());
        }