Example #1
0
        public int AddEmployee(EmployeeModel employeeModel)
        {
            string Name = employeeModel.Name;
            // actorName = actor.ActorName;
            var InsertQuery = "INSERT INTO Employee(Name ) " +
                              "VALUES (@Name) ;SELECT @@IDENTITY AS 'ID';";

            SqlDataAccess d = new SqlDataAccess(con.GetConnectionForSql());

            d.Connection.Open();
            var cmd = d.Command(InsertQuery);

            //  AddObjectParameter(d, cmd, "actorId", actorId);
            AddObjectParameter(d, cmd, "Name", Name);

            int i = d.ExecuteInlineSqlQueryNew(cmd);

            return(i);
        }
Example #2
0
        public int AddSalary(SalaryModel salaryModel)
        {
            double   salary     = salaryModel.SalaryPaidAmount;
            DateTime salaryDate = salaryModel.Date;
            int      empId      = salaryModel.EmployeeId;
            // actorName = actor.ActorName;
            var InsertQuery = "INSERT INTO salary(salary_amount_paid,Fk_EmployeeId ) " +
                              "VALUES (@salary,@empId) ;SELECT @@IDENTITY AS 'ID'; ";

            SqlDataAccess d = new SqlDataAccess(con.GetConnectionForSql());

            d.Connection.Open();
            var cmd = d.Command(InsertQuery);

            //  AddObjectParameter(d, cmd, "actorId", actorId);
            AddObjectParameter(d, cmd, "salary", salary);
            AddObjectParameter(d, cmd, "empId", empId);

            int i = d.ExecuteInlineSqlQueryNew(cmd);

            // d.Connection.Close();
            return(i);
        }