コード例 #1
0
        public static void Update(int parentId, Parents parents)
        {
            try
            {
                Persons.PersonUpdate(parents.PersonId, parents);
                LoginDetails.Update(parents.LoginDetailsId, parents.LoginDetails);

                db.cmd.CommandText = @"UPDATE [dbo].[tblParents]
                            SET [Person_ID] = @pid
                             ,[LoginDetail_ID] = @lid
                                WHERE Id=id";
                db.cmd.Parameters.AddWithValue("@pid", parents.PersonId);
                db.cmd.Parameters.AddWithValue("@lid", parents.LoginDetailsId);


                db.cmd.Parameters.AddWithValue("@id", parents.Id);

                db.con.Open();
                db.cmd.ExecuteNonQuery();
            }

            catch (SqlException sqlex)
            {
                SqlExceptionErrorHandling rh = new SqlExceptionErrorHandling();
                rh.GetError(sqlex);
            }
            finally
            {
                db.CloseDb(db.con, db.cmd);
            }
        }
コード例 #2
0
        public static void Update(int id, Students std)
        {
            try
            {
                Parents.Update(std.ParentsId, std.Parents);
                PersonUpdate(std.PersonId, std);
                LoginDetails.Update(std.LoginDetailsId, std.LoginDetails);

                db.cmd.CommandText = @"UPDATE [dbo].[tblStudents]
   SET [RegistrationID] = @regid
      ,[DiscountPercentage] =  @disper
      ,[IdentityCardUrl] =  @idcard
      ,[AdmissionCard] =  @addmission
      ,[PostalAddress] =  @post
      ,[ResidentialAddress] =  @resi
      ,[Person_ID] =  @perid1
      ,[LoginDetail_ID] =  @lid1
      ,[Parent_ID] =  @pid1
      ,[Class_ID] =  @cid1
 WHERE Id=@id";
                db.cmd.Parameters.AddWithValue("@regid", std.RegistrationId);
                db.cmd.Parameters.AddWithValue("@disper", std.DiscountPercentage);
                db.cmd.Parameters.AddWithValue("@idcard", std.IdentityCardUrl);
                db.cmd.Parameters.AddWithValue("@addmission", std.AdmissionCard);
                db.cmd.Parameters.AddWithValue("@post", std.PostalAddress);
                db.cmd.Parameters.AddWithValue("@resi", std.ResidentialAddress);
                db.cmd.Parameters.AddWithValue("@perid1", std.PersonsId);
                db.cmd.Parameters.AddWithValue("@lid1", std.LoginDetailsId);
                db.cmd.Parameters.AddWithValue("@pid1 ", std.ParentsId);
                db.cmd.Parameters.AddWithValue("@cid1 ", std.ClassesId);


                db.cmd.Parameters.AddWithValue("@id", std.Id);

                db.con.Open();
                db.cmd.ExecuteNonQuery();
            }

            catch (SqlException sqlex)
            {
                SqlExceptionErrorHandling rh = new SqlExceptionErrorHandling();
                rh.GetError(sqlex);
            }
            finally
            {
                db.CloseDb(db.con, db.cmd);
            }
        }
コード例 #3
0
        public static void Update(int empId, Employees employees)
        {
            try
            {
                Persons.PersonUpdate(employees.PersonId, employees);
                LoginDetails.Update(employees.LoginDetailsId, employees.LoginDetails);

                db.cmd.CommandText = @" update tblEmployees set RegistrationID=@regid,
                                  Salary=@salary,IdentityCardUrl=@idcardurl,
                                  PostalAddress=@postaladd,ResidentialAddress=@residadd,
                                  AggrementUrl=@aggurl,Person_ID=@pid,
                                  Designation_ID=@did,
                                  EmployeeType_ID=@eid,
                                  LoginDetail_ID=@lid where Id=@id;";
                db.cmd.Parameters.AddWithValue("@regid", employees.RegistrationID);
                db.cmd.Parameters.AddWithValue("@salary", employees.Salary);
                db.cmd.Parameters.AddWithValue("@idcardurl", employees.IdentityCardUrl);
                db.cmd.Parameters.AddWithValue("@postaladd", employees.PostalAddress);
                db.cmd.Parameters.AddWithValue("@residadd", employees.ResidentialAddress);
                db.cmd.Parameters.AddWithValue("@aggurl", employees.AggrementUrl);
                db.cmd.Parameters.AddWithValue("@pid", employees.PersonsId);
                db.cmd.Parameters.AddWithValue("@did", employees.DesignationsId);
                db.cmd.Parameters.AddWithValue("@eid ", employees.EmployeeTypesId);
                db.cmd.Parameters.AddWithValue("@lid ", employees.LoginDetailsId);


                db.cmd.Parameters.AddWithValue("@id", employees.Id);

                db.con.Open();
                db.cmd.ExecuteNonQuery();
            }

            catch (SqlException sqlex)
            {
                SqlExceptionErrorHandling rh = new SqlExceptionErrorHandling();
                rh.GetError(sqlex);
            }
            finally
            {
                db.CloseDb(db.con, db.cmd);
            }
        }