コード例 #1
0
        public int PrcUpdateEarnings(EarningsModel bEarningsModel)
        {
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Query = "Update tblEarnings set Amount='" + bEarningsModel.Amount + "',Comments='" + bEarningsModel.Comment + "',Source='" + bEarningsModel.Source + "'," +
                    "dtEarn='" + bEarningsModel.DtEarn + "',OutstandingAmount='" + bEarningsModel.OutstandingAmount + "' where Id='" + bEarningsModel.ID + "'";
            Command = new SqlCommand(Query, Connection);
            int rowAffected = Command.ExecuteNonQuery();

            Connection.Close();
            return(rowAffected);
        }
コード例 #2
0
        public int PrcSaveEarnings(EarningsModel bEarningsModel)
        {
            int newId = 0;

            Query   = "Select IsNull(max(Id),0)+1 as Id from tblEarnings";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                newId = Convert.ToInt32(Reader["Id"]);
            }
            Reader.Close();
            Query = "Insert into tblEarnings Values('" + newId + "','" + bEarningsModel.Amount + "','" + bEarningsModel.Source + "','" + bEarningsModel.DtEarn + "'" +
                    ",'" + bEarningsModel.OutstandingAmount + "','" + bEarningsModel.Comment + "')";
            Command = new SqlCommand(Query, Connection);
            int rowAffected = Command.ExecuteNonQuery();

            Connection.Close();
            return(rowAffected);
        }
コード例 #3
0
        public List <EarningsModel> PrcGetEarningsList(string date)
        {
            List <EarningsModel> earningList = new List <EarningsModel>();

            Query   = "Exec prcGetEarningsDetails '" + date + "'";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                EarningsModel bEarningsModel = new EarningsModel();
                bEarningsModel.ID                = Convert.ToInt32(Reader["Id"]);
                bEarningsModel.Source            = Reader["Source"].ToString();
                bEarningsModel.DtEarn            = Reader["DtEarn"].ToString();
                bEarningsModel.OutstandingAmount = Convert.ToInt32(Reader["OutstandingAmount"]);
                bEarningsModel.Amount            = Convert.ToInt32(Reader["Amount"]);
                bEarningsModel.Comment           = Reader["Comments"].ToString();
                earningList.Add(bEarningsModel);
            }
            Reader.Close();
            Connection.Close();
            return(earningList);
        }